Data Structures : Stacks and Queues using Lists || Type C || Sumita Arora || Class 12 || Computer science || Information practices || Solution ||


Q1. Write a program that depending upon user's choice, either pushes or pops an element in a stack .


Q2. A line of text is read from the input terminal into a stack. Write a program to output the string in reverse order, each character appearing twice. (e.g., the string a  b c d e should be changed to ee dd cc bb aa)


Q3. Write a function in Python POP(Arr), where Arr is a stack implemented by a list of numbers. The function returns the value deleted from the stack. 


Q4. Write a program that depending upon user's choice, either pushes or pops an element in a stack the  elements are shifted towards right so that top always remains at 0th (zero) index.


Q5. Write a program to insert or delete an element from a queue depending upon user's choice elements are not shifted after insertion or deletion.


Q6. Write a program to insert or delete an element from a queue depending upon user's choice.


Q7. Write a program to implement input-restricted deque. (Both the operations i.e., insertions and deletion should be taken care of.)


Q8. Each node of a STACK contains the following information :

(1) Pin code of a city,

(ii) Name of city

Write a program to implement following operations in above stack

(a) PUSH () To push a node in to the stack.

(b) POP( ) To remove a rode from the stack.


Q9. Write a program that implements three queues namely HighestPr, NormalPr and LowestPr. The program accepts an element along with its priority from the user.


Q10. Write PUSH (Books) and POP (Books) methods, in python to add Books and remove book considering them to act as Push and Pop operations of Stack.


Q11. Write Insert(City) and Delete(City) methods in Python to add City and Remove City considering them to act as Insert and Delete operations of the data structure Queue.


2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post