Some "hello world"-style data structure objects. Helps with inane tech interview questions and/or teaching computer science - whichever comes first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charles Reid 2603def0bd Adding binary tree in Go 5 years ago
BinaryTree.go Adding binary tree in Go 5 years ago
LinkedList.go Adding binary tree in Go 5 years ago adding Go linked list 5 years ago

Go Data Structures

Linked List

Go allows you to create pointers to structs (equivalent to classes in Go).

The node is defined to take a generic "interface" type (meaning, we can create a struct as a type, and use that as the linked list element data).

We then define some functions on the Node struct, including an Append() method and a String() method.

This class illustrates how we can use structs as slimmed down objects, and use function-like syntax with those structs to define methods on that struct's data.