Saturday, October 17, 2015

Assignment Linked list , stack , queue

ASSIGNMENT STACK QUEUE LINKED LIST


  1.   (A) Evaluate the following postfix notation of expression:                                                                            
20,30,+,50,40,-,*

(B) Write a function in C++ to perform Insert operation in a dynamically allocated Queue   
      containing names of students.           

   2     (A)  Write a function in C++ to delete a node containing names of student ,
from a dynamically allocated Queue of names implemented with the help
of following structure :                                                                            
struct student
{
            char name[20];
            student *next;

}*front , *rear;
(b)          Consider the following portion of a program , which implements a linked  stack for Library . Write the definition of function PUSH(),to insert a new node in the stack with required information                                              
struct Library
{         
           int id;
            char names[20];
            Library * next;           
};
class stack
{
            Library *top;
            public :
stack()
            {
            top=NULL;    
}
            void PUSH();
            void POP();
};
(c)          Convert the following infix expression into postfix. show the stack status
 after execution of each operation:                                                          
TRUE OR   FALSE AND   NOT    FALSE   OR  FALSE

3   (A)  Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers.                                                                                                                                                  
(b)  Evaluate the following postfix notation of expression:                                                                        
True, False, AND, True, True, NOT, OR, AND

 4. A ) Consider the following program for linked QUEUE:                                                   
struct NODE
{ int x;

float y;
NODE *next; };

class QUEUE
{ NODE *R,*F;;
 public :
            QUEUE( )
            {
             R=NULL;
             F=NULL;
           }

void INSERT( );
void DELETE( );
void Show( );
~QUEUE( ); };
            Define INSERT( ) & DELETE( ) functions outside the class.

 B ) Evaluate the following postfix expression using stack and show the contents after
execution of each operations                                                                                470,5,4,^,25,/,6,*,+,81,- 


 5.  (A) Define function stackpush( ) to insert nodes and stackpop( ) to delete nodes, for a linklist implemented stack having the following structure for each node:
            struct Node
            {           char name[20];        
                        int age;
                        Node *Link;
            };
            class STACK
            {           Node * Top;
                        Public:
                        STACK( ) { Top=NULL;}
                        void stackpush( );
                        void stackpop( );
                        ~STACK( );
            };                                                         
(B) Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation:
TRUE,FALSE, TRUE FALSE, NOT, OR, TRUE , OR,OR,AND






No comments:

Post a Comment

ASSIGNMENT INHERITANCE

ASSIGNMENT INHERITANCE