Chapter 10: Data Structures - II: Stacks and Queues
Chapter 10: Data Structures - II: Stacks and Queues Type C: Programming Practice/ Knowledge based Questions 1. Write a program that depending upon user's choice, either pushes or pops an element in a stack. 2. A line of text is read from the input terminal into a stack. Write a program to output the string in the reverse order, each character appearing twice. ( e.g., the string a b c d e should be changed to ee dd cc bb aa ) 3. 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 (zeroth) index. (N.B: If the elements are shifted downwards or towards right side, then unused free spaces are available at the beginning of the list otherwise free space is available at the end of the list) 4. Write a program to insert or delete an element from a queue depending upon user's choice. The elements are not shifted after insertion or d...