diff --git a/README.md b/README.md index f3d6f17..20f86f3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,12 @@ In this repository, you'll find codes for Data Structure Lab. 5. [DSL - Assignment 5 (String)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-5.py) 11. DSL - Assignment 11 (Linear, Sentinel, Binary, Fibonnaci Search) - _PENDING_ 14. [DSL - Assignment 14 (Selection, Bubble Sorting)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-14.py) +<<<<<<< HEAD 16. [DSL - Assignment 16 (Quick sort)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-16.cpp) +======= +16. [DSL - Assignment 16 (Quick sort)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-16.py) +29. [DSL - Assignment 29 (Queue Job)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-29.py) +>>>>>>> fc6d144 (Added link for assignment-29 to README) ### Write-ups @@ -52,9 +57,7 @@ In this repository, you'll find codes for Data Structure Lab. > These are the codes we're working on. They *may not work* the way intended. > To view all the codes that are being built, checkout the [testing branch](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing). -[quicksortEarlyAccess.py](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/quicksortEarlyAccess.py) - -[assignment-29 (Early access).cpp](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/assignment-29%20%28Early%20access%29.cpp) +**ALL TESTING CODES HAVE BEEN MERGED IN THE MAIN BRANCH.** --- diff --git a/assignment-29.cpp b/assignment-29.cpp new file mode 100644 index 0000000..0046c0d --- /dev/null +++ b/assignment-29.cpp @@ -0,0 +1,132 @@ +#include +using namespace std; + +class queue { +// Class for queue. + + int data[30]; + int front,rear; + + public: + queue() { + // Constructor that initialises values for front and rear. + front=-1; + rear=-1; + } + + int emptyCheck() { + // Check if it's empty + if (front==-1) { + return 1; + } + else { + return 0; + } + } + + int fullCheck() { + // Check if it's full + if (rear>=30) { + return 1; + } + else { + return 0; + } + } + + void enqueue(int x) { + // Add job to queue + if (fullCheck()==1) { + cout<>totalJobs; + for (int i=0; i>job; + jobQueue.enqueue(job); + } + + while (1) { + cout< Add job to queue"< Delete a job from queue"< Display queue"< Exit"<>choice; + + switch (choice) { + case 1: + cout<<"Add additional job:\t"; + cin>>job; + jobQueue.enqueue(job); + cout<<"\n==============\n"; + jobQueue.display(); + cout<<"=============\n"; + break; + + case 2: + jobQueue.dequeue(); + cout<<"\n==============\n"; + jobQueue.display(); + cout<<"=============\n"; + break; + + case 3: + cout<<"\n==============\n"; + jobQueue.display(); + cout<<"=============\n"; + break; + + case 4: + cout<<"\n## DESIGNED AND ENGINEERED BY KSHITIJ\n## END OF CODE\n\n"; + exit(0); + + default: + cout<