I am working (in Java) on a recursive image processing algorithm that recursively traverses the pixels of the image, outwards from a center point.
Unfortunately, tha
I think you can some up with simple like implementation
package DataStructures;
public class Queue {
private Node root;
public Queue(T value) {
root = new Node(value);
}
public void enque(T value) {
Node node = new Node(value);
node.setNext(root);
root = node;
}
public Node deque() {
Node node = root;
Node previous = null;
while(node.next() != null) {
previous = node;
node = node.next();
}
node = previous.next();
previous.setNext(null);
return node;
}
static class Node {
private T value;
private Node next;
public Node (T value) {
this.value = value;
}
public void setValue(T value) {
this.value = value;
}
public T getValue() {
return value;
}
public void setNext(Node next) {
this.next = next;
}
public Node next() {
return next;
}
}
}