Tuesday, July 24, 2012

PIE Linked Lists

C++


public class Node {
   Node* next;
   object data;
}

public class LinkedList {
   Node* head;
}

Java

public class Node {
   public Node next;
   public object data;
}
public class LinkedList{
   public Node head;
}

Ruby (not sure about this)
Node = Struct.new(:next, :data)
list = Cell.new("head",nil)


No comments:

Post a Comment