DSA Lab 7 D1 - v4
DSA Lab 7 D1 - v4
Stack
Batch – D1
(February, 2024)
2. Create another directory named “LAB number” within the roll number directory.
3. Within the “LAB_number” directory place your files. Follow the naming convention as
“RollNumber_PracticeQuestionNumber.c” (for example 23200100_p1.c) for practice
questions. Follow the naming convention as “RollNumber_TestQuestionNumber.c” (for
example 23200100 test1.c) for test questions.
2. Ensure your assigned TA has checked your practice question and test question solutions
and you are evaluated for the same.
void main()
{ //Input the sequence of operations o
//Use the Check() function to verify that the sequence is valid or not
}
Expected Output:
Expected Output:
void main()
{ //Scan the input infix expression
//Use the function InfixToPrefix() to convert the input expression to prefix expression
}
Expected Outcome:
5. There are 3 towers and n disks of different sizes sorted in ascending order of
size from top to bottom on one rod, the smallest at the top. All the disks in one
tower should be moved onto another tower such that the disks are stacked in the
same way as in original tower.
Constraints:
Only one disk can be moved at a time
A disk is moved off the top of one tower onto the another tower
A disk can only be placed on top of a larger disk
You are free to use either array based stack or a linked list based stack; define
the parameters for the moveDisk() function appropriately depending on your
choice.
void main()
{ //Scan the number of disks (n)
//Compute the way to transfer n disks from source to destination
}
Expected Output:
Use the Queue data structure to implement this and use an array to
implement the queue. Assume that the maximum number of customers to
be served in a day is 100.
int InsertCustomer(int id, int *queue, int front, int rear)
{ // Insert the customer id into the queue
// Return the position of the new customer in the queue
}
void main()
{ //Design a menu driven system to implement the banking token
system }
Expected output :