The document outlines fundamental concepts of data structures, including definitions, types, and specific operations related to stacks and queues. It includes practical exercises on evaluating expressions, performing stack operations, and manipulating sequences of push and pop actions. Additionally, it explores scenarios for inserting elements into circular queues and provides challenges for rearranging pop orders.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views1 page
Sheet1,2 Stack Queue
The document outlines fundamental concepts of data structures, including definitions, types, and specific operations related to stacks and queues. It includes practical exercises on evaluating expressions, performing stack operations, and manipulating sequences of push and pop actions. Additionally, it explores scenarios for inserting elements into circular queues and provides challenges for rearranging pop orders.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Sheet (1) Stack and Queue
1- What is Data Structure? Explain.
2- Describe the types of Data Structures? 3- What are the scenarios in which an element can be inserted into the circular queue?
4- Evaluate the following expressions:
123+*45*6++ 123+*45*+6+ 12+3*45*6++
5- Consider the following sequence of stack operations: push(d),
push(h), pop(), push(f), push(s), pop(), pop(), push(m). (a) Assume the stack is initially empty, what is the sequence of popped values, and what is the final state of the stack? (Identify which end is the top of the stack.) (b) Suppose you were to replace the push and pop operations with enqueue and dequeue respectively. What would be the sequence of dequeued values, and what would be the final state of the queue? (Identify which end is the front of the queue.) 6- - Suppose you have a stack in which the values 1 through 5 must be pushed on the stack in that order, but that an item on the stack can be popped at any time. Give a sequence of push and pop operations such that the values are popped in the following order: (a) 2, 4, 5, 3, 1 (b) 1, 5, 4, 2, 3 (c) 1, 3, 5, 4, 2
pop(), pop(). (a) What is the order in which the elements are popped? (Give a list and indicate which was popped first.) (b) Change the position of the pop() commands in the above sequence so that the items are popped in the following order: b,d,c,a,e.