Documentation
¶
Index ¶
- type BinaryHeap
- func (heap *BinaryHeap) Count() int
- func (heap *BinaryHeap) GetTop25() []Enterprice
- func (heap *BinaryHeap) Height() int
- func (heap *BinaryHeap) Pop() (*Enterprice, bool)
- func (heap *BinaryHeap) Print()
- func (heap *BinaryHeap) Push(value Enterprice)
- func (heap *BinaryHeap) Root() *Binder
- func (heap *BinaryHeap) Validate() bool
- type Binder
- type Enterprice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryHeap ¶
type BinaryHeap struct {
// contains filtered or unexported fields
}
BinaryHeap is a binary search tree with a prioritet
func NewBinaryHeap ¶
func NewBinaryHeap(values ...Enterprice) *BinaryHeap
NewBinaryHeap is a constructor, which returns pointer on a new heap object
func (*BinaryHeap) Count ¶
func (heap *BinaryHeap) Count() int
Count is a method which returns count of items in BinaryHeap
func (*BinaryHeap) GetTop25 ¶
func (heap *BinaryHeap) GetTop25() []Enterprice
GetTop25 returns top 25 the most profit companies
func (*BinaryHeap) Height ¶
func (heap *BinaryHeap) Height() int
Height is a method, which retunrs count of levels in heap
func (*BinaryHeap) Pop ¶
func (heap *BinaryHeap) Pop() (*Enterprice, bool)
Pop is a method, which returns the first item of heap
func (*BinaryHeap) Print ¶
func (heap *BinaryHeap) Print()
Print is a method, which allows to print out a heap
func (*BinaryHeap) Push ¶
func (heap *BinaryHeap) Push(value Enterprice)
Push is a method, which allows to add a new item to the heap
func (*BinaryHeap) Root ¶
func (heap *BinaryHeap) Root() *Binder
Root is a method, which retunrs first item of data array
func (*BinaryHeap) Validate ¶
func (heap *BinaryHeap) Validate() bool
Validate is a method, which validate a heap
type Binder ¶
type Binder struct {
// contains filtered or unexported fields
}
Binder is a struct which works like a node in BinaryHeap for printing a heap
func (*Binder) RightChild ¶
RightChild is a method, which returns a poiner on the right child
func (*Binder) Value ¶
func (binder *Binder) Value() *Enterprice
Value is a method, which returns a value of node
type Enterprice ¶
Enterprice is a structure, which allows us to store informatqion about some company
func NewEnterprice ¶
func NewEnterprice(name, address string, month time.Month, year, profit int) Enterprice
NewEnterprice is a constructor, which returns a pointer of new enterprice structure