CSE 214 Lecture Notes - Lecture 2: Null Pointer, Fibonacci Heap, Getlink

17 views9 pages

Document Summary

Arrays can be used to store linear data of similar types, but arrays have following limitations: the size of the arrays is xed: so we must know the upper limit on the number of elements in advance. A singly-linked list is a sequence of data elements (of the same type) arranged one after another conceptually. Each node also contains a link that connects this node to the next node in the list. A special link called the head references the first node in a list. Some lists may also have a special link called the tail that references the last node in a list. A cursor is a link that points to one of the nodes of the list. //defining a node public class intnode{ private int data; private intnode link; //link can be whatever name. Intnode nodeptr = head; //if you are defining a variable to reference a node that already exists, dont use new.