@ -12,6 +12,7 @@ Implementation of various data structures in Go.
- [TreeSet](#treeset)
- [Lists](#lists)
- [ArrayList](#arraylist)
- [DoublyLinkedList](#doublylinkedlist)
- [Stacks](#stacks)
- [LinkedListStack](#linkedliststack)
- [ArrayStack](#arraystack)
@ -182,6 +183,44 @@ func main() {
}
```
#####DoublyLinkedList
This structure implements the _List_ interface and is a linked data structure where each element points to the next and previous element in the list.
Direct access method _Get(index)_ and _Remove()_ are of linear performance. _Append_ and _Prepend_ are of constant time performance. Checking with _Contains()_ is of quadratic complexity.
The stack interface represents a last-in-first-out (LIFO) collection of objects. The usual push and pop operations are provided, as well as a method to peek at the top item on the stack, a method to check whether the stack is empty and the size (number of elements).