c19 manual added

This commit is contained in:
tejasjokin 2023-10-28 18:53:36 +05:30
commit 525d85ba15
12 changed files with 302 additions and 8 deletions

2
.gitignore vendored
View File

@ -194,3 +194,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# VIM swap file
*.swp

View File

@ -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) 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) 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_ 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) 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) - _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) 32. [DSL - Assignment 32 (Circular queue)](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/assignment-32.cpp)
### Write-ups ### 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) 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) 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) 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_ 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_ 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)** 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 - _TO BE ADDED_ 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 ### 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) 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) 33. [Mini Project](https://git.kska.io/sppu-se-comp-codes/DSL/src/branch/main/lab-manuals/Miniproject.doc)
### Notes ### 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) 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) 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) 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) 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 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 ### 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. > 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). > 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)** **ALL TESTING CODES MERGED IN MAIN BRANCH. NO CHANGES PENDING.**
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)**
--- ---

161
assignment-31.cpp Normal file
View File

@ -0,0 +1,161 @@
#include <iostream>
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;
}

125
assignment-32.cpp Normal file
View File

@ -0,0 +1,125 @@
#include <iostream>
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;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.