A list is a data structure that can store elements and may have repeated values. There is no ordering in a list. The user can access and remove an element by the index position.
A list is a data structure that can store values and may have repeated values. There is no ordering in a list. The user can access and remove a value by the index position.
All lists implement the list interface with the following methods:
@ -134,11 +134,11 @@ All lists implement the list interface with the following methods:
type Interface interface {
Get(index int) (interface{}, bool)
Remove(index int)
Add(elements ...interface{})
Contains(elements ...interface{}) bool
Add(values ...interface{})
Contains(values ...interface{}) bool
Sort(comparator utils.Comparator)
Swap(index1, index2 int)
Insert(index int, elements ...interface{})
Insert(index int, values ...interface{})
containers.Interface
// Empty() bool
@ -188,7 +188,7 @@ func main() {
#####SinglyLinkedList
This structure implements the _List_ interface and is a linked data structure where each element points to the next in the list.
This structure implements the _List_ interface and is a linked data structure where each value points to the next 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.
@ -225,7 +225,7 @@ 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.
This structure implements the _List_ interface and is a linked data structure where each value 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.