Documentation ¶
Index ¶
- type HashTab
- func (tt *HashTab[T]) Delete(find *T) (found bool)
- func (tt *HashTab[T]) DeleteFound(find *dll.DllElement[T]) (found bool)
- func (tt *HashTab[T]) Dump(fp io.Writer)
- func (tt *HashTab[T]) Insert(item *T)
- func (tt HashTab[T]) IsEmpty() bool
- func (tt *HashTab[T]) ItemExists(find *T) (rv bool)
- func (tt *HashTab[T]) Len() int
- func (tt *HashTab[T]) Length() int
- func (tt *HashTab[T]) Search(find *T) (rv *dll.DllElement[T])
- func (tt *HashTab[T]) Truncate()
- func (ns *HashTab[T]) Walk(fx dll.ApplyFunction[T], userData interface{}) (rv *dll.DllElement[T], pos int)
- type Hashable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashTab ¶
type HashTab[T comparable.Equality] struct { // contains filtered or unexported fields }
HashTab is a generic binary tree
func (*HashTab[T]) Delete ¶
Delete an element from the hash_tab. The element needs to have been located with "Search" or as a result of a match using the Walk function. Complexity is O(1)
func (*HashTab[T]) DeleteFound ¶ added in v0.0.6
func (tt *HashTab[T]) DeleteFound(find *dll.DllElement[T]) (found bool)
xyzzy -
func (*HashTab[T]) Insert ¶
func (tt *HashTab[T]) Insert(item *T)
Insert will add a new item to the tree. If it is a duplicate of an exiting item the new item will (*old: replace the existing one.*) be inserted before the old one - hiding it (it will act like a stack). Complexity is O(log n)/k.
func (HashTab[T]) IsEmpty ¶
IsEmpty will return true if the binary-tree is empty Complexity is O(1).
func (*HashTab[T]) ItemExists ¶ added in v0.0.8
if ok := ht.ItemExists(&DefinedItem{Name: in}); !ok {
func (*HashTab[T]) Search ¶
func (tt *HashTab[T]) Search(find *T) (rv *dll.DllElement[T])
Search will walk the tree looking for `find` and retrn the found item if it is in the tree. If it is not found then `nil` will be returned. Complexity is O(log n)/k.
func (*HashTab[T]) Truncate ¶
func (tt *HashTab[T]) Truncate()
Truncate removes all data from the tree. Complexity is O(1).
func (*HashTab[T]) Walk ¶ added in v0.0.8
func (ns *HashTab[T]) Walk(fx dll.ApplyFunction[T], userData interface{}) (rv *dll.DllElement[T], pos int)
Walk - Iterate from head to tail of list. O(n)