Page 181 - C++
P. 181

Address of an element (I,J) in row major = B+W(C(I-Lr)+(J-Lc ))

        Therefore, 1500 = B+4(20(5-0)+(2- 0))

        1500 = B+4(20*5+2)

        1500 = B+4*102

        1500 = B+408

        B =1500-408

        B=1092

        Address of Arr[3][2] =1092+4(20*3+2)

        =1092+4(62)

        =1092+248

        =1340.

         (d) Write a function in C++ to perform a DELETE operation in a dynamically allocated queue considering the
        following description:                                                                               (4)
        struct Node
        {
               float U, V ;
               Node *Link ;
        } ;
        class QUEUE
        {
               Node *Rear, *Front ;
        public :
               QUEUE( )
               {
               Rear = NULL ;
               Front = NULL ;
               }
               void INSERT( ) ;
               void DELETE( ) ;
               ~ QUEUE( ) ;
        } ;
        Ans.

         void Queue::DELETE( )

        {

               NODE *temp;

               if(Front= = NULL)

                       cout<<”\nQueue Underflow”;
   176   177   178   179   180   181   182   183   184   185   186