Documentation
¶
Overview ¶
Package linkedlist implements:
Create a a new Linkedlist and Node Insert a Node at the beginning of the list Insert a Node at the end of the list Delete a Node from the beginning of the list Delete a Node from the end of the list Print the Linkedlis
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Linkedlist ¶
Linkedlist struct holds a linked list
func (*Linkedlist) AddAtBeg ¶
func (ll *Linkedlist) AddAtBeg(val interface{})
AddAtBeg adds a Node at the beginning of the list
func (*Linkedlist) AddAtEnd ¶
func (ll *Linkedlist) AddAtEnd(val interface{})
AddAtEnd adds a Node at the end of the list
func (*Linkedlist) DelAtBeg ¶
func (ll *Linkedlist) DelAtBeg() interface{}
DelAtBeg deletes a node from the beginning of the list
func (*Linkedlist) DelAtEnd ¶
func (ll *Linkedlist) DelAtEnd() interface{}
DelAtEnd deletes a node from the end of the list
func (*Linkedlist) DeleteWithValute ¶
func (ll *Linkedlist) DeleteWithValute(val interface{}) interface{}
DeleteWithValute deletes a node which value is equal to the function parameter
func (*Linkedlist) String ¶
func (ll *Linkedlist) String() string
utility function to print the linkedlist
type Node ¶
type Node struct { Val interface{} Next *Node }
Node struct holds a node the value of the Node could be anything (int, string or a struncture) interface{} - an empty interface may hold values of any type. if using interface{} confuse you, change with any type you would like initially I started with int value, but some problems require strings as values another example: implementing Hash-Table I need even to define a Key-Value struct