Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 980 Bytes

File metadata and controls

52 lines (41 loc) · 980 Bytes

Chapter 3

Linear Data Structures

  • Lists
  • Sets
  • Tuples
  • Stacks

LinkedList

LinkedList is a sequence of nodes that have properties and a reference to the next node in
the sequence. It is a linear data structure that is used to store data. The data structure
permits the addition and deletion of components from any node next to another node. They
are not stored contiguously in memory, which makes them different arrays.
type Node struct{
    property int
    nextNode *Node
    }

The LinkedList class has headNode pointer as its property.

// LinkedList class
type LinkedList struct {
 headNode *Node
}

See LinkedList Source Code

// Node class
type Node struct {
 property int
 nextNode *Node
 previousNode *Node
}