mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-02-04 04:23:32 +08:00
Added Queues, Priority Queues and Linked Lists
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user