Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joegasewicz/linky
Fully complete linked list library 🔗
https://github.com/joegasewicz/linky
abstract-data-types adt linked-list linklist
Last synced: 15 days ago
JSON representation
Fully complete linked list library 🔗
- Host: GitHub
- URL: https://github.com/joegasewicz/linky
- Owner: joegasewicz
- Created: 2024-02-08T22:45:19.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-02-11T14:24:24.000Z (11 months ago)
- Last Synced: 2024-10-30T22:55:41.874Z (2 months ago)
- Topics: abstract-data-types, adt, linked-list, linklist
- Language: Go
- Homepage: https://pkg.go.dev/github.com/joegasewicz/linky
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Linky
Fully complete Linked list library. This is a Go port of a C library - [lists](https://github.com/joegasewicz/lists).
### API#### ListInit
ListInit should be called before any operation can be used on with
the linked list
```
l := LinkedListInit(data)
```#### ListDestroy
ListDestroy destroys the linked list. No operations are permitted to
be called on the linked list after ListDestroy is called
```
err = LinkedListDestroy(l.LinkedList)
```#### InsertNext
InsertNext inserts a node after the current linked list element.
If the element is nil then the new element gets placed at the head
of the list & then return the tail.
```
err, tailNode := l.LinkedList.InsertNext(l.tailNode, data)
```#### RemoveNext
RemoveNext removes the next element after node & returns an error
if one exists & the removed node's data. If the node is nil then the
head of the list is removed & the head's data returned.
```
err, node := l.LinkedList.RemoveNext(nil)
```
#### ListSize
ListSize returns the total number of nodes in the list.
```
size := l.LinkedList.ListSize()
```
#### ListHead
ListHead returns the head of the list
```
head := l.LinkedList.ListHead()
```### ListTail
ListTail returns the tail node of the list.
```
tail := l.Tail()
```#### IsHead
IsHead determines if element is the head of the list.
```
isHead := l.IsHead(node)
```#### IsTail
IsTail determines if element is the tail of the list.
```go
isTail := l.IsTail(node)
```
#### Evaluate
Evaluate returns the data of element's Node```go
err, result = l.Evaluate(node)
```#### NextNode
NextNode returns the next Node in the list.
```go
err, nextNode := l.NextNode(node)
```