Documentation
¶
Index ¶
- type DataStructureEmptyError
- type LinkedList
- func (l *LinkedList) AddNode(val interface{}) *Node
- func (l *LinkedList) AddNodeToFront(val interface{}) *Node
- func (l *LinkedList) AddNodesBySlice(values []interface{})
- func (l *LinkedList) DeleteNodeByRef(n *Node)
- func (l *LinkedList) Equals(l1 *LinkedList) bool
- func (l *LinkedList) Last() *Node
- func (l *LinkedList) Length() int
- func (l *LinkedList) String() string
- type Node
- type Queue
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStructureEmptyError ¶
type DataStructureEmptyError struct{}
func (DataStructureEmptyError) Error ¶
func (s DataStructureEmptyError) Error() string
type LinkedList ¶
type LinkedList struct {
Head *Node
}
func SliceToLinkedList ¶
func SliceToLinkedList(values []interface{}) *LinkedList
func (*LinkedList) AddNode ¶
func (l *LinkedList) AddNode(val interface{}) *Node
func (*LinkedList) AddNodeToFront ¶
func (l *LinkedList) AddNodeToFront(val interface{}) *Node
func (*LinkedList) AddNodesBySlice ¶
func (l *LinkedList) AddNodesBySlice(values []interface{})
func (*LinkedList) DeleteNodeByRef ¶
func (l *LinkedList) DeleteNodeByRef(n *Node)
Caveat: Node must be part of list. It should not be a rogue node otherwise things will be messy
func (*LinkedList) Equals ¶
func (l *LinkedList) Equals(l1 *LinkedList) bool
func (*LinkedList) Last ¶
func (l *LinkedList) Last() *Node
Returns last node of list l If head is nil then it returns nil.
func (*LinkedList) Length ¶
func (l *LinkedList) Length() int
func (*LinkedList) String ¶
func (l *LinkedList) String() string
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) Peek ¶
func (q *Queue) Peek() (interface{}, *DataStructureEmptyError)
func (*Queue) Remove ¶
func (q *Queue) Remove() (interface{}, *DataStructureEmptyError)
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func (*Stack) Peek ¶
func (s *Stack) Peek() (interface{}, *DataStructureEmptyError)
Returns the top element of stack. If stack is empty then returns error of type StackEmptyError
func (*Stack) Pop ¶
func (s *Stack) Pop() (interface{}, *DataStructureEmptyError)
Click to show internal directories.
Click to hide internal directories.