public class Node { private int data; private Node right; private Node left; Node() { } Node(int data) { this.setData(data); this.setLeft(null); this.setRight(null); } public int getData() { return this.data; } public Node getRight() { return this.right; } public Node getLeft() { return this.left; } public void setData(int data) { this.data = data; } public void setRight(Node right) { this.right = right; } public void setLeft(Node left) { this.left = left; } }
/* Helper class for all Linked list data structures */ class LinkNode { private int data; private LinkNode link; LinkNode() { } LinkNode(int data) { this.setData(data); this.setLink(null); } public int getData() { return this.data; } public LinkNode getLink() { return this.link; } public void setData(int data) { this.data = data; } public void setLink(LinkNode link) { this.link = link; } }
Sunday, 2 September 2012
DS for tree and link list
Labels:
Data Structures
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment