#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    23
    Rep Power
    0

    Queue Array Based Implementations


    My question is this, in the .h file i have:
    Code:
     private:
        int maxSize;
        int front;
        int back;
        DataType* dataItems;
    and i want to use this enqueue method:
    Code:
    template <typename DataType>
    void QueueArray<DataType>::enqueue(const DataType& newDataItem) throw (logic_error){
    /*	
    */
    
    }
    I have written a LinkedList based queue
    but have never written an array based. My question is:

    in a linked list based version front would be the front of the queue and i would use front->next to goto the next node in the queue.
    In this it has a field that is a pointer 3 ints front and back and a maxSize
    front would be the number that front is at? back same and maxSize would be the maxsize of the array and then there is a pointer, does the pointer point to just a dataItem and if so how would i access it?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    23
    Rep Power
    0
    I actually answered my own question dataItems[number i want to access] correct?

IMN logo majestic logo threadwatch logo seochat tools logo