Else return false keytype delete keytype if isempty

This preview shows page 2 - 5 out of 7 pages.

//else return FALSE KeyType* Delete ( KeyType &); //if (IsEmpty()), then return 0 //else remove and return the pointer to the top of the stack .Data member declarations private: int top ; KeyType * stack ; int MaxSize ; Implementation of Stack- CreateStack template <class KeyType> Stack<KeyType>::Stack(int MaxStackSize) : MaxSize (MaxStackSize) { stack= new KeyType[MaxSize]; top = -1; } Implementation of member function IsFull() //p129 Implementation of member function IsEmpty() //p129 2
Image of page 2

Subscribe to view the full document.

Implementation of member function Add() //program 3.7, p129 Implementation of member function Delete() //program 3.8, p129 The Queue Abstract Data Type Queue An ordered list All insertions take place at one end, rear rear All deletions take place at the opposite end, front front First-In-First-Out ( FIFO FIFO ) Illustration Abstract Data Type Queue template <class KeyType> class Queue { // objects : a finite ordered list with zero or more elements. public : Queue( int MaxQueueSize= DefaultSize); //create an empty queue whose maximum size is MaxQueueSize 3 A front rear AB fron t rear ABCD front rear BCD front rear
Image of page 3
Boolean IsFullQ (); //if (number of elements in queue== MaxQueueSize ) return TRUE //else return FALSE void Add (const Keytype& item); //if (IsFullQ()) then QueueFull() //else insert item at rear of queue Boolean IsEmptyQ (); //if number of elements in the
Image of page 4

Subscribe to view the full document.

Image of page 5
  • Spring '13
  • L
  • Pointer, Subroutine, Type theory

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern