Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 1.75 KB

File metadata and controls

47 lines (36 loc) · 1.75 KB

DS - Stack Queue Operations

This project solves the certain problems of Data Structures using Stacks and Queues.

Question 1: Transfer elements from stack S1 to stack S2 so that the elements from stack S2 are in the same order as on stack S1 • Using one additional stack (Use either array or link list to implement stack and for input only take integers)

Question 2: Put the elements on the stack S in ascending order using one additional stack and some additional variables. (Use either array or link list to implement stack and for input only take integers)

Question 3: Define a stack in terms of a queue. That is, create a class Class StackQ { Queue Q; . . . . . . . . . . Void push (int e1) { Q.enqueue(e1); . . . . . . . . . . (Use either array or link list to implement stack and for input only take integers)

Question 4: Define a queue in terms of a stack. (Use either array or link list to implement stack and for input only take integers)

Question 5: Reverse the order of elements on stack S1 a) Using two additional stacks b) Using one additional queue c) Using one additional stack and some additional variables (Make a Reverse( ) function in stack class)

Question 6: Write a program that determines whether or not an input string is a palindrome, that is, whether or not it can be read the same way forward and backward. Use stack implementation. (Consider using multiple stacks.)

Example: MADAM, it is a palindrome.

Question 7: Given a string, write a program (Use stack implementation) to check whether the pairs and the orders of “{“ , ”}” , ”(“ , ”)” , ”[" , “]” are balanced.

Example= “[ ( ) ] { } { [( )( )] ( ) }”
Above expression have balance brackets