Like arrays, linked lists are a fundamental datastructure category upon which more complex datastructures can be based. Unlike a sequence of elements, however, a linked list is a sequence of nodes, where each node is linked to the previous and next node in the sequence. Recall that a node is an object created from a self-referential class, and a self-referential class has at least one field whose reference type is the class name. Nodes in a linked list are linked via a node reference. Here’s an example:
class Employee
{
private int empno;
private String name;
private double salary;
public Employee next;
// Other members.
}
In this example, Employee
is a self-referential class because its next
field has type Employee
. This field is an example of a link field because it can store a reference to another object of its class–in this case another Employee
object.
Find A Teacher Form:
https://docs.google.com/forms/d/1vREBnX5n262umf4wU5U2pyTwvk9O-JrAgblA-wH9GFQ/viewform?edit_requested=true#responses
Email:
public1989two@gmail.com
www.itsec.hk
www.itsec.vip
www.itseceu.uk