Saturday 17th April 2021
 CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Link Lists Stacks And Queues Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE LINKED LISTS , STACKS AND QUEUES 3.c) Write a function in C++ to insert anelement into a dynamically allocated Queuewhere each node contains a name (of type string) as data. Assume the following definition of THENODE for the same. struct THENODE { char Name[20]; THENODE *Link; }; Solution: struct THENODE { char Name[20]; THENODE *Link; }; class Queue{ THENODE *front,*rear; public: Queue( ) { front = rear = NULL; } void Insert( ); void Delete( ); void Display( ); }; void Queue::Insert( ) { THENODE *ptr; ptr=new THENODE; if(ptr= = NULL) { cout<<”\nNo memory to create a new node….”; exit(1); } cout<<”\nEnter the name….”; gets(ptr→ Name); ptr→ Link=NULL; if(rear= = NULL) front=rear=ptr; else { rear→ Link=ptr; rear=ptr; } } 3.e) Evaluate the following postfix notation of expression (Show status of stack after execution of each operation ): 4, 10, 5, +, *, 15, 3, /, -     4 CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )