- Learn Data Structures and Algorithms with Golang
- Bhagvan Kommadi
- 68字
- 2021-06-24 15:37:46
The LinkedList class
The LinkedList class has the headNode pointer as its property. By traversing to nextNode from headNode, you can iterate through the linked list, as shown in the following code:
// LinkedList class
type LinkedList struct {
headNode *Node
}
The different methods of the LinkedList class, such as AddtoHead, IterateList, LastNode, AddtoEnd, NodeWithValue, AddAfter, and the main method, are discussed in the following sections.