list

package
v0.0.0-...-5c8b7b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyList = errors.New("lista vacia")

Errores comunes en las listas

View Source
var ErrFullList = errors.New("lista llena")
View Source
var ErrOutOfRangeList = errors.New("fuera de rango")

Functions

func TestALG_Append

func TestALG_Append(t *testing.T)

func TestALG_Clear

func TestALG_Clear(t *testing.T)

func TestALG_Find

func TestALG_Find(t *testing.T)

func TestALG_Insert

func TestALG_Insert(t *testing.T)

func TestALG_Next

func TestALG_Next(t *testing.T)

func TestALG_Prev

func TestALG_Prev(t *testing.T)

func TestALG_Remove

func TestALG_Remove(t *testing.T)

func TestALG_Vacia

func TestALG_Vacia(t *testing.T)

Types

type ArrayList

type ArrayList struct {
	// contains filtered or unexported fields
}

func NewArrayList

func NewArrayList(capacidad int) *ArrayList

constructor

func (*ArrayList) Append

func (lista *ArrayList) Append(valor int) (err error)

func (*ArrayList) Clear

func (lista *ArrayList) Clear()

func (ArrayList) CurrentElement

func (lista ArrayList) CurrentElement() (valor int, err error)

func (*ArrayList) Find

func (lista *ArrayList) Find(valor int) int

func (*ArrayList) Insert

func (lista *ArrayList) Insert(valor int) (err error)

func (ArrayList) Length

func (lista ArrayList) Length() int

metodos

func (*ArrayList) MoveToEnd

func (lista *ArrayList) MoveToEnd()

func (*ArrayList) MoveToPos

func (lista *ArrayList) MoveToPos(pos int) (err error)

func (*ArrayList) MoveToStart

func (lista *ArrayList) MoveToStart()

func (*ArrayList) Next

func (lista *ArrayList) Next()

func (*ArrayList) Prev

func (lista *ArrayList) Prev()

func (*ArrayList) Remove

func (lista *ArrayList) Remove() (valor int, err error)

func (ArrayList) String

func (lista ArrayList) String() string

type ArrayListGeneric

type ArrayListGeneric[T comparable] struct {
	// contains filtered or unexported fields
}

func NewArrayListGeneric

func NewArrayListGeneric[T comparable](capacidad int) *ArrayListGeneric[T]

constructor

func (*ArrayListGeneric[T]) Append

func (lista *ArrayListGeneric[T]) Append(valor T) (err error)

func (*ArrayListGeneric[T]) Clear

func (lista *ArrayListGeneric[T]) Clear()

func (ArrayListGeneric[T]) CurrentElement

func (lista ArrayListGeneric[T]) CurrentElement() (valor T, err error)

func (*ArrayListGeneric[T]) Find

func (lista *ArrayListGeneric[T]) Find(valor T) int

func (*ArrayListGeneric[T]) Insert

func (lista *ArrayListGeneric[T]) Insert(valor T) (err error)

func (ArrayListGeneric[T]) Length

func (lista ArrayListGeneric[T]) Length() int

metodos

func (*ArrayListGeneric[T]) MoveToEnd

func (lista *ArrayListGeneric[T]) MoveToEnd()

func (*ArrayListGeneric[T]) MoveToPos

func (lista *ArrayListGeneric[T]) MoveToPos(pos int) (err error)

func (*ArrayListGeneric[T]) MoveToStart

func (lista *ArrayListGeneric[T]) MoveToStart()

func (*ArrayListGeneric[T]) Next

func (lista *ArrayListGeneric[T]) Next()

func (*ArrayListGeneric[T]) Prev

func (lista *ArrayListGeneric[T]) Prev()

func (*ArrayListGeneric[T]) Remove

func (lista *ArrayListGeneric[T]) Remove() (valor T, err error)

func (ArrayListGeneric[T]) String

func (lista ArrayListGeneric[T]) String() string

type LinkedList

type LinkedList struct {
	// contains filtered or unexported fields
}

func NewLinkedList

func NewLinkedList() *LinkedList

constructor (inicializador)

func (*LinkedList) Append

func (lista *LinkedList) Append(e int) (node *Node)

Agrega un nodo al final de la lista (tail)

func (*LinkedList) Clear

func (lista *LinkedList) Clear()

Remueve todos los nodos de la lista

func (LinkedList) CurrentElement

func (lista LinkedList) CurrentElement() (e int, err error)

func (LinkedList) CurrentPosition

func (lista LinkedList) CurrentPosition() int

func (*LinkedList) Insert

func (lista *LinkedList) Insert(e int) (node *Node)

Agrega un nodo desplazando al nodo actual (curr)

func (LinkedList) Length

func (lista LinkedList) Length() int

func (*LinkedList) MoveToEnd

func (lista *LinkedList) MoveToEnd()

Coloca [curr] en el tail

func (*LinkedList) MoveToPos

func (lista *LinkedList) MoveToPos(pos int) (err error)

Mueve [curr] una cantidad de nodos (pos) a partir de head

func (*LinkedList) MoveToStart

func (lista *LinkedList) MoveToStart()

Coloca al [curr] en el nodo head

func (*LinkedList) Next

func (lista *LinkedList) Next()

Se adelanta un nodo

func (*LinkedList) Prev

func (lista *LinkedList) Prev()

Retrocede un nodo

func (*LinkedList) Remove

func (lista *LinkedList) Remove() (node *Node, err error)

Remueve el nodo actual (curr)

type List

type List interface {
	Clear()  // O(1)
	Length() // O(1)

	Append(e int)      // O(1) *Agrega al tail..
	Insert(e int)      // O(n)
	Remove()           // O(n)
	MoveToStart()      // O(1)
	MoveToEnd()        // O(1)
	MoveToPos(pos int) // Array: O(1) LinkedList: O(n)
	Prev()             // Array: O(1) LinkedList: O(n)
	Next()             // O(1)
	CurrentPosition()  // Array: O(1) LinkedList: O(n)
	CurrentElement()   // O(1)
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(element int) *Node

Funcion que permite inicializar un objeto de tipo Node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL