-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype.go
45 lines (36 loc) · 787 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package datastruct
type LinkedList struct {
Head *ListNode
length int
}
type ListNode struct {
Next *ListNode
Value interface{}
}
type BinaryTree struct {
Root *BinaryTreeNode
}
type BinaryTreeNode struct {
Left *BinaryTreeNode
Right *BinaryTreeNode
Value interface{}
}
type BinaryTreeHandleFunc func(node *BinaryTreeNode) error
type BinaryTreeErrorHandleFunc func(err error)
// Stack is a linked list
type Stack struct {
*LinkedList
}
type Queue struct {
*LinkedList
}
//Heap is a list which implements heap interface, we use ismax to indicate whether the heap is a max heap or min heap
type Heap struct {
*LinkedList
ismax bool //true for max heap, false for min heap
}
//HeapNode is a node in Heap
type HeapNode struct {
Value interface{}
Priority int
}