You are on page 1of 3

ASSIGMENT 2

DATA STRUCTURE

QUESTION 1 :
Write a function in C++ to insert in a static circular Queue containing Players information
(represented with the help of array of structure PLAYER).

Assume the following definition of MYNODE for the same:

stuct PLAYER{

int PID;

char Pname[20];

NODE *Next ;

};

(Note: made array based queue output should be clear as array based.

QUESTION 2 :

Convert the given Infix to postfix expression

 ((A+B)*C-(D-E)) $(F+G)
 A+B*(C+D)/F+D*E
 Q+F-W*S/D-R/T*P

Show the status of stack after execution of each operation as shown in the example below.
QUESTION 3 :
Evaluate the given Postfix expression. Show your working in the table by providing each
iteration. Assume the value of ABCDEFGH at your own: Also fill the table with example as
well.

 ABC*DEF^/G *- H*+

QUESTION 4 :
Write a function to convert infix into postfix using stack and check it by using question 2
expressions.

Note: use link list based stack.


QUESTION 5 :
Write down the function to evaluate the following postfix expression using array based Stack,
also check the question 3rd expressions using this function.

QUESTION 6 :
Write a code to create shelf contains 20 books .Each book has specific name and a unique
number .Select three book from the middle and removed it from the stack by displaying its name
and unique number with all remaining books contains on the shelf. After that put that removed
books at the top of all books. ( using array based stack)

Note output should be clear and arranged

QUESTION 7 :
Create a queue for ten persons of any name, suppose when a specific person comes to that queue
give them a high priority and shift them directly at the first position of the queue and keep its
previous or position place empty. After that display all the queue before shifting and after
shifting that particular person

Note made queue from linked list and output should be clear and arranged

Enjoy the Weekend with the assignment 

You might also like