p0707

package
v0.0.0-...-9d9ab22 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyLinkedList

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

func Constructor

func Constructor() MyLinkedList

* Initialize your data structure here.

func (*MyLinkedList) AddAtHead

func (this *MyLinkedList) AddAtHead(val int)

* Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.

func (*MyLinkedList) AddAtIndex

func (this *MyLinkedList) AddAtIndex(index int, val int)

* Add a node of value val before the index-th node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted.

func (*MyLinkedList) AddAtTail

func (this *MyLinkedList) AddAtTail(val int)

* Append a node of value val to the last element of the linked list.

func (*MyLinkedList) DeleteAtIndex

func (this *MyLinkedList) DeleteAtIndex(index int)

* Delete the index-th node in the linked list, if the index is valid.

func (*MyLinkedList) Get

func (this *MyLinkedList) Get(index int) int

* Get the value of the index-th node in the linked list. If the index is invalid, return -1.

func (*MyLinkedList) Print

func (this *MyLinkedList) Print()

Jump to

Keyboard shortcuts

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