diff --git a/.gitignore b/.gitignore index 8125bf6..da9d0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -194,3 +194,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +# VIM swap file +*.swp diff --git a/README.md b/README.md index 813fd9e..827109d 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ In this repository, you'll find codes for Data Structure Lab. 19. [DSL - Assignment 19 (Pinnacle Club)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-19.cpp) 29. [DSL - Assignment 29 (Queue job)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-29.cpp) 30. DSL - Assignment 30 (Priority queue) - _TO BE ADDED_ -31. DSL - Assignment 31 (Double-ended queue) - _TESTING AND REFINING PENDING_ - Code available in [testing branch](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/assignment-31%20%28double-ended%20queue%29.cpp) -32. DSL - Assignment 32 (Circular queue) - _TESTING AND REFINING PENDING_ - Code available in [testing branch](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/assignment-32%20%28circular%20queue%29.cpp) +31. [DSL - Assignment 31 (Double-ended queue)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-31.cpp) +32. [DSL - Assignment 32 (Circular queue)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-32.cpp) ### Write-ups 1. [Assignment 1 - Cricket, Badminton, Football](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment%201%20%28cricket%2C%20badminton%2C%20football%29.pdf) @@ -29,10 +29,10 @@ In this repository, you'll find codes for Data Structure Lab. 14. [Assignment 14 - Selection, Bubble Sorting](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-14%20%28selection%2C%20bubble%20sort%29.pdf) 16. [Assignment 16 - Quick sort](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-16%20%28quick%20sort%29.pdf) 19. Assignment 19 - Pinnacle Club - _TO BE ADDED_ -29. [Assignment 29 - Queue job](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-29%20%28queue%29.pdf) **(without flowchart)** +29. [Assignment 29 - Queue job](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-29%20%28queue%29.pdf) 30. Assignment 30 - Priority queue - _TO BE ADDED_ -31. [Assignment 31 - Double-ended queue](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-31%20%28double-ended%20queue%29.pdf) **(without flowchart)** -32. Assignment 32 - Circular queue - _TO BE ADDED_ +31. [Assignment 31 - Double-ended queue](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-31%20%28double-ended%20queue%29.pdf) +32. [Assignment 32 - Circular queue](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/write-ups/assignment-32%20%28circular%20queue%29.pdf) ### Lab Manuals 1. [Assignment 1 - Cricket, Badminton, Football](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/lab-manuals/Lab%20Assignment%20A_01.pdf) @@ -49,14 +49,21 @@ In this repository, you'll find codes for Data Structure Lab. 33. [Mini Project](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/lab-manuals/Miniproject.doc) ### Notes - 1. [Unit 1 - Introduction to Algorithm and Data Structures](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/Unit%201) 2. [Unit 2 - Linear Data Structure Using Sequential Organization](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/Unit%202) 3. [Unit 3 - Searching and Sorting](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/Unit%203) +<<<<<<< HEAD 3. [Unit 4 - Linked List](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/Unit%204) +======= +4. [Unit 4 - Linked List](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/Unit%204) +>>>>>>> 8321c44c8171f3dd7b8c120d1d7694183f38b217 ### [Question Bank](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/notes/FDS%20-%20Question%20Bank%20%28Unit%201-6%29.pdf) +### Question Papers +1. [IN-SEM](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/question-papers/IN-SEM) +2. [END-SEM](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/question-papers/END-SEM) + --- ### Work in progress @@ -64,8 +71,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). -1. [DSL - Assignment 31 (Double-ended queue)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/assignment-31%20%28double-ended%20queue%29.cpp) **(FROM MA'AM, NOT TESTED)** -2. [DSL - Assignment 32 (Circular queue)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/testing/assignment-32%20%28circular%20queue%29.cpp) **(FROM MA'AM, NOT TESTED)** +**ALL TESTING CODES MERGED IN MAIN BRANCH. NO CHANGES PENDING.** --- diff --git a/assignment-31.cpp b/assignment-31.cpp new file mode 100644 index 0000000..2eb6947 --- /dev/null +++ b/assignment-31.cpp @@ -0,0 +1,161 @@ +#include +using namespace std; + +#define SIZE 5 + +class Dequeue +{ + + int a[10], front, rear, count; + +public: + Dequeue() + { + front = -1; + rear = -1; + count = 0; + } + void addBegin(int item) + { + int i; + if (front == -1) + { + front++; + rear++; + a[rear] = item; + count++; + } + else if (rear >= SIZE - 1) + { + cout << "\nInsertion is not possible,overflow!!!!"; + } + else + { + for (i = count; i >= 0; i--) + { + a[i] = a[i - 1]; + } + a[i] = item; + count++; + rear++; + } + } + void addEnd(int item) + { + + if (front == -1) + { + front++; + rear++; + a[rear] = item; + count++; + } + else if (rear >= SIZE - 1) + { + cout << "\nInsertion is not possible,overflow!!!"; + return; + } + else + { + a[++rear] = item; + } + } + void deleteFront() + { + if (front == -1) + { + cout << "Deletion is not possible:: Dequeue is empty"; + return; + } + else + { + if (front == rear) + { + front = rear = -1; + return; + } + cout << "The deleted element is " << a[front]; + front = front + 1; + } + } + void deleteEnd() + { + if (front == -1) + { + cout << "Deletion is not possible:Dequeue is empty"; + return; + } + else + { + if (front == rear) + { + front = rear = -1; + } + cout << "The deleted element is " << a[rear]; + rear = rear - 1; + } + } + void display() + { + + for (int i = front; i <= rear; i++) + { + cout << a[i] << " "; + } + } +}; + +int main() +{ + int c, item; + Dequeue d1; + + do + { + cout << "\n\n****DEQUEUE OPERATION****\n"; + cout << "\n1-Insert at beginning"; + cout << "\n2-Insert at end"; + cout << "\n3_Display"; + cout << "\n4_Deletion from front"; + cout << "\n5-Deletion from rear"; + cout << "\n6_Exit"; + cout << "\nEnter your choice<1-6>:"; + cin >> c; + + switch (c) + { + case 1: + cout << "Enter the element to be inserted:"; + cin >> item; + d1.addBegin(item); + break; + + case 2: + cout << "Enter the element to be inserted:"; + cin >> item; + d1.addEnd(item); + break; + + case 3: + d1.display(); + break; + + case 4: + d1.deleteFront(); + break; + case 5: + d1.deleteEnd(); + break; + + case 6: + exit(1); + break; + + default: + cout << "Invalid choice"; + break; + } + + } while (c != 7); + return 0; +} \ No newline at end of file diff --git a/assignment-32.cpp b/assignment-32.cpp new file mode 100644 index 0000000..115504f --- /dev/null +++ b/assignment-32.cpp @@ -0,0 +1,125 @@ +#include +using namespace std; + +#define size 5 + +class pizza +{ + int porder[size]; + int front, rear; + +public: + pizza() + { + front = rear = -1; + } + int qfull() + { + if (front == (rear + 1) % size) + return 1; + else + return 0; + } + int qempty() + { + if (front == -1) + return 1; + else + return 0; + } + void accept_order(int item) + { + if (qfull()) + cout << "\nVery Sorry !!!! No more orders....\n"; + else + { + if (front == -1) + { + front = rear = 0; + } + else + { + rear = (rear + 1) % size; + } + porder[rear] = item; + } + } + void make_payment(int n) + { + int item; + char ans; + if (qempty()) + cout << "\nSorry !!! order is not there...\n"; + else + { + cout << "\nDeliverd orders as follows...\n"; + for (int i = 0; i < n; i++) + { + item = porder[front]; + if (front == rear) + { + front = rear = -1; + } + else + { + front = (front + 1) % size; + } + cout << "\t" << item; + } + cout << "\nTotal amount to pay : " << n * 100; + cout << "\nThank you visit Again....\n"; + } + } + void order_in_queue() + { + int temp; + if (qempty()) + { + cout << "\nSorry !! There is no pending order...\n"; + } + else + { + temp = front; + cout << "\nPending Order as follows..\n"; + while (temp != rear) + { + cout << "\t" << porder[temp]; + temp = (temp + 1) % size; + } + cout << "\t" << porder[temp]; + } + } +}; + +int main() +{ + pizza p1; + int ch, k, n; + do + { + cout << "\n\t***** Welcome To Pizza Parlor *******\n"; + cout << "\n1.Accept order\n2.Make_payment\n3.Pending Orders\nEnter u r choice:"; + cin >> ch; + switch (ch) + { + case 1: + cout << "\nWhich Pizza would do u like to have today\n"; + cout << "\n1.Veg Soya Pizza\n2.Veg butter Pizza\n3.Egg_Pizza"; + cout << "\nPlease enter your order: "; + cin >> k; + p1.accept_order(k); + break; + case 2: + cout << "\nHow many Pizza ?"; + cin >> n; + p1.make_payment(n); + break; + case 3: + cout << "\n Following orders are in queue to deliver....as follows..\n"; + p1.order_in_queue(); + break; + } + } while (ch != 4); + + return 0; +} \ No newline at end of file diff --git a/lab-manuals/Lab Assignment C_19.pdf b/lab-manuals/Lab Assignment C_19.pdf index 21e76c5..aab8f37 100644 Binary files a/lab-manuals/Lab Assignment C_19.pdf and b/lab-manuals/Lab Assignment C_19.pdf differ diff --git a/lab-manuals/Lab Assignment E_29.pdf b/lab-manuals/Lab Assignment E_29.pdf index 3d3cebf..5e82b84 100644 Binary files a/lab-manuals/Lab Assignment E_29.pdf and b/lab-manuals/Lab Assignment E_29.pdf differ diff --git a/lab-manuals/Lab Assignment E_31.pdf b/lab-manuals/Lab Assignment E_31.pdf index 499ea12..212b629 100644 Binary files a/lab-manuals/Lab Assignment E_31.pdf and b/lab-manuals/Lab Assignment E_31.pdf differ diff --git a/lab-manuals/Lab Assignment E_32.pdf b/lab-manuals/Lab Assignment E_32.pdf index 872589d..627246a 100644 Binary files a/lab-manuals/Lab Assignment E_32.pdf and b/lab-manuals/Lab Assignment E_32.pdf differ diff --git a/question-papers/Endsem/FDS Endsem 2019 Pattern.pdf b/question-papers/END-SEM/FDS Endsem 2019 Pattern.pdf similarity index 100% rename from question-papers/Endsem/FDS Endsem 2019 Pattern.pdf rename to question-papers/END-SEM/FDS Endsem 2019 Pattern.pdf diff --git a/question-papers/Insem/FDS Insem 2019 Pattern.pdf b/question-papers/IN-SEM/FDS Insem 2019 Pattern.pdf similarity index 100% rename from question-papers/Insem/FDS Insem 2019 Pattern.pdf rename to question-papers/IN-SEM/FDS Insem 2019 Pattern.pdf diff --git a/write-ups/assignment-31 (double-ended queue).pdf b/write-ups/assignment-31 (double-ended queue).pdf index 4b0b61e..52dc009 100644 Binary files a/write-ups/assignment-31 (double-ended queue).pdf and b/write-ups/assignment-31 (double-ended queue).pdf differ diff --git a/write-ups/assignment-32 (circular queue).pdf b/write-ups/assignment-32 (circular queue).pdf new file mode 100644 index 0000000..b0f1685 Binary files /dev/null and b/write-ups/assignment-32 (circular queue).pdf differ