March 2019
Intermediate to advanced
336 pages
9h 9m
English
A doubly linked list is a data structure that consists of nodes that have links to the previous and the next nodes. Doubly linked lists were presented with code examples in Chapter 3, Linear Data Structures. Lists in Go are implemented as doubly linked lists. The elements 14 and 1 are pushed backward and forward, respectively. The elements 6 and 5 are inserted before and after. The doubly linked list is iterated and the elements are printed. The code in this section shows how lists can be used:
//main package has examples shown// in Go Data Structures and algorithms bookpackage main// importing fmt and list packageimport ( "container/list" "fmt")// main methodfunc main() { var linkedList *list.List linkedList = list.New() ...Read now
Unlock full access