March 2019
Intermediate to advanced
336 pages
9h 9m
English
The main method adds the nodes with integer properties of 1, 3, and 5, as shown in the following code. A node with an integer property of 7 is added after the node with an integer property of 1. The IterateList method is invoked on the linkedList instance, as follows:
// main methodfunc main() { var linkedList LinkedList linkedList = LinkedList{} linkedList.AddToHead(1) linkedList.AddToHead(3) linkedList.AddToEnd(5) linkedList.AddAfter(1,7) linkedList.IterateList()}
The main method adds 1 and 3 to the head of the linked list. 5 is added to the end. 7 is added after 1. The linked list will be 3, 1, 7, and 5.
Run the following commands to execute the linked_list.go file:
go run linked_list.go
After executing the preceding command, ...
Read now
Unlock full access