Given the following function of a Front operation Function R

Given the following function of a Front operation: Function: Return a copy of the front item on the queue. Precondition: Queue is not empty. Postcondition: Function value = copy of the front item on the queue. Queue is not changed. Write this function as client code, using operations from the QueType class. Remember that the client code has no access to the private members of the class.

Solution

ItemType Front(QueType& queue){
   if(front==0 && rear == size -1){ //check queue empty condition
       ItemType ele = queue[front]; //getting front element
       return ele;
   }
   return null; //if queue is empty
}

 Given the following function of a Front operation: Function: Return a copy of the front item on the queue. Precondition: Queue is not empty. Postcondition: Fun

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site