Added Queues, Priority Queues and Linked Lists

This commit is contained in:
Rian Gallagher
2016-11-22 15:55:15 +00:00
parent 67d3bf5ee1
commit c65e562e70
2 changed files with 71 additions and 2 deletions

View File

@@ -22,10 +22,10 @@ class PriorityQueue{
else{
int j = nItems;
while(j > 0 && queueArray[j-1] > value){
queueArray[j] = queueArray[j-1];
queueArray[j] = queueArray[j-1]; //Shifts every element up to make room for insertion
j--;
}
queueArray[j] = value;
queueArray[j] = value; //Once the correct position is found the value is inserted
}
nItems++;
}