Back to home

data-structures/

go-linked-list

Version: 0.0.6

Last Updated: Unknown


Go Linked List

Generating a basic Linked List.

Creates a node with data and a link.

Functions for the list include:

  1. insertFirst: Insert at the head of list
  2. getFirst: Fetch the first node
  3. getLast: Fetch the last node
  4. clear: Remove all node
  5. removeFirst: Remove head of list
  6. removeLast: Remove last node
  7. insertLast: Insert at end of list
  8. getAt: Fetch node at index
  9. removeAt: Remove node at index
  10. insertAt: Insert at index
  11. forEach: Iterate through list and run function on list

insertFirst

Tips:

  • Create a list that had a head, size and lock property
  • Create a node that holds some form of data and has another property pointing to another node

getFirst

Return a pointer to the first node.

Install


Repository

https://github.com/okeeffed/pkg-data-structures-go-linked-list

Sections