Priority Queue, implementations 1 & 2

Here are the first two implementations of priority Queue. Fairly straightforward, although a doubly linked list is a bit fiddly.

Doubly linked list header file;

#ifndef _linked_list_pqueue_
#define _linked_list_pqueue_

#include "pqueue.h"
#include <string>

class LinkedListPQueue : public PQueue {
public:
	LinkedListPQueue();
	~LinkedListPQueue();
	
	static LinkedListPQueue *merge(LinkedListPQueue *one, LinkedListPQueue *two);
	
	void enqueue(const std::string& elem);
    std::string extractMin();
    std::string peek() const;
	
private:
	struct cellT {
        std::string word;
        cellT *prev;
        cellT *next;
    };
    
    cellT *head, *tail, *cursorA, *cursorB;
};

#endif

Doubly linked list class file;

#include "pqueue-linked-list.h"
#include "error.h"


using namespace std;

LinkedListPQueue::LinkedListPQueue() {
    head = tail = NULL;
}

LinkedListPQueue::~LinkedListPQueue() {
    cellT *cp = head;
    while (cp != NULL) {
        cellT *del = cp->next;
        delete cp;
        cp = del;
    }
}

string LinkedListPQueue::peek() const {
    if (isEmpty()) error("Empty queue");
    string first = head->word;
    return first;
}

string LinkedListPQueue::extractMin() {
    if (isEmpty()) error("Empty queue");
    string first = head->word;
    cellT *dequeued = head;
    head = head->next;
    delete dequeued;
    logSize--;
    return first;
    
}

void LinkedListPQueue::enqueue(const string& elem) {
    cellT *newCell = new cellT;
    newCell->word = elem;
        if (isEmpty()) {
            newCell->prev = NULL;
            newCell->next = NULL;
            head = tail = newCell;
    }
        else if (elem <= head->word) {
            newCell->next = head;
            head->prev = newCell;
            newCell->prev = NULL;
            head = newCell;
    }
        else if (elem >= tail->word) {
            tail->next = newCell;
            newCell->prev = tail;
            newCell->next = NULL;
            tail = newCell;
    }
        else {
            for (cursorA = tail; cursorA != NULL; cursorA = cursorA->prev) {
                if (cursorA->word <= elem) {
                    cursorB = tail;
                    while (cursorB->prev != cursorA) {
                        cursorB = cursorB->prev;
            }
                    cursorB->prev = newCell;
                    newCell->prev = cursorA;
                    newCell->next = cursorB;
                    cursorA->next = newCell;
                    break;
            }
        }
    }
    logSize++;
}

LinkedListPQueue *LinkedListPQueue::merge(LinkedListPQueue *one, LinkedListPQueue *two) {
	LinkedListPQueue *result = new LinkedListPQueue;
    for (int i = 0; i < 1000; i++) {
        string test1 = one->extractMin();
        string test2 = two->extractMin();
        result->enqueue(test1);
        result->enqueue(test2);
    }
	return result;
}

Vector based pqueue header file;

#ifndef _vector_pqueue_
#define _vector_pqueue_

#include "pqueue.h"
#include <string>
#include "vector.h"



class VectorPQueue : public PQueue {
public:
	VectorPQueue();
	~VectorPQueue();
	
	static VectorPQueue *merge(VectorPQueue *one, VectorPQueue *two);
	
	void enqueue(const std::string& elem);
    std::string extractMin();
    std::string peek() const;
	
private:
    Vector<string> pQueue;
};

#endif

Vector based pqueue class file;

#include "pqueue-vector.h"

using namespace std;

VectorPQueue::VectorPQueue() {
    Vector<string> pQueue;
}

VectorPQueue::~VectorPQueue() {
    
}

string VectorPQueue::peek() const {
    if(isEmpty()) {
        error("peek; Attempting to peek at an empty queue");
    }
    string result = pQueue.get(0);
	return result;
}

string VectorPQueue::extractMin() {
    if (isEmpty()) {
        error("extractmin; Queue is empty");
    }
    int min = 0;
    string minimum = pQueue.get(0);
	for (int i= 1; i < logSize; i++) {
        string check = pQueue.get(i);
        if (check < minimum) {
            min = i;
            minimum = check;
        }
    }
    pQueue.remove(min);
    logSize--;
	return minimum;
}

void VectorPQueue::enqueue(const string& elem) {
	pQueue.add(elem);
    logSize++;
}

VectorPQueue *VectorPQueue::merge(VectorPQueue *one, VectorPQueue *two) {
    VectorPQueue *result = new VectorPQueue;
    for (int i = 0; i < 1000; i++) {
        string test1 = one->extractMin();
        string test2 = two->extractMin();
        result->enqueue(test1);
        result->enqueue(test2);
        }
	return result;
}