|
hello friends, i am learning Linked list and i am not sure what are the difference between these three linked list?
[code]
public class CircularLinkedList
{// creating constructor?
Node head;
Node tail;
public CircularLinkedList()
{
Node n = new Node();
head = n;
tail = n;
}
public CircularLinkedList(Object obj)
{
Node n = new Node(obj);
head = n;
tail = n;
}[/code]
|
|
|
public class CircularLinkedList // this is the class declaration
{
// declare instance variables (class scope)
Node head;
Node tail;
/**
* no-argument constructor
*/
public CircularLinkedList()
{
Node n = new Node(); // initialize with an empty node
head = n;
tail = n;
}
/**
* one-argument constructor
*/
public CircularLinkedList(Object obj)
{
Node n = new Node(obj); // initialize nodes with argument value
head = n;
tail = n;
|
|
|
|
|
|
|
|
|
|
|
|