PL - 7 Data Structure
PL - 7 Data Structure
Data Structure
1 Write a menu driven program to implement a stack with the help of a list of integers. Use separate
functions for performing PUSH and POP operations. POP operation should display “Stack is
EMPTY” message, if the list acting as a stack contains nothing in it. Call both the functions, with
the help of menu driven options.
2 Given the following expected information of a list Book,
● Code of type integer
● Title of the type string
Write a menu driven program to implement a stack of Book having two separate functions to perform
PUSH and POP operations.
3 Write a Python code with the following functions in Python
● PUSH(ITEMLIST,ST), where ITEMLIST is a nested list of lists containing INO (an integer), ITEM(a
string), QTY(an integer). From this list, push all lists in Stack ST, which have QTY<10.
● POP(ST), to remove and return an item from the top of STACK and should return a string with the
content as “No reorder ITEM” when there are no more items left in ST to be popped.
● DISPLAY(ST), to display the content of the stack if it has at least one element, otherwise display an
appropriate error message as “No reorder ITEM”. Also,