A Go package that implements useful data structures in go. These Libraries are not Concurrent safe for any operations.
All functions are manifest enough. For finding a node by its value implements Equals function for your structure.
All functions have same functionalities for other sets library in other
languages.I define Sets structure that holding Values map[interface{}]bool for data.
- I implement three function for
setsthat you can find those insetslib.
I define stacks.Element for holding value and stacks.S for holding an array of stacks.Element.
- So I define just two function
S.Push(*Element)andS.Pop().
My suggestion about implementing the Equals function for LinkedLists, Sets, Queues and Stacks.
I use reflect package for applying basic metaProgramming for intelligent
comparison.
func (s *<Struct>) Equals(data *<Struct>) bool {}
func (s <Struct>) Equals(data <Struct>) bool {}My suggestion about implementing the Equals function for Trees.
I use reflect package for applying basic metaProgramming for intelligent
comparison.
- Your Equals method must returns 1, -1, 0 for getting the efficient result.
- Trees, I use 1 when
rootN.Vis greater thanv; -1 forvis greater thanrootN.V; And 0 for equality.
func (s *<Struct>) Equals(data *<Struct>) int {}
func (s <Struct>) Equals(data <Struct>) int {}