Hi all, I am trying to properly code a moveUp() method that will move an item above another in a queue. This method is inside my QueueList class which extends LinkedList. What I am trying to have it do is the method will take a parameter int of the index for which to move higher. Having issues with my logic here so I was hoping someone could work out the kinks. I have it coded like so:
Code :public void moveUp(int index) { Node current = head; Node previous = null; Node follow = null; int count = -1; for (Node i = head; i != null && count < index; i = i.next) { previous = current; follow = current; current = current.next; count++; } current = follow; current.next = previous.next; }
