Skip to content

rojack96/treje

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treje

A lightweight, idiomatic and extensible collection of data structures in Go.

Treje aims to provide clean implementations of common data structures not available in the Go standard library — starting with Set & MapSet.

Features (Current)

✅ Set implementation
✅ MapSet implementation
✅ Operations:

  • Manipulation: Add, Remove, Discard, Pop
  • Set operations: Union, Intersection, Difference, SymmetricDifference
  • IsSubsetOf, Equals

✅ Utilities:

  • Has()
  • IsEmpty()
  • Clear()
  • Min() & Max()
  • Sum() (numbers) or Concat(separator) (string)
  • Sort() & ReverseSort()
  • Copy()
  • ToSlice()

Installation

go get github.com/rojack96/treje

Example

A := treje.NewSet().Int8(1, 2, 3)
A.Add(4)
B := treje.NewSet().Int8(3, 4, 5)

diff := A.Difference(B) // [1 2]

fmt.Println("Difference:", diff)

Planned Additions

  • Set
  • MapSet (Set backed by map for performance)
  • Stack
  • Queue
  • Deque
  • Linked List
  • Tree structures (BST, AVL, etc.)
  • Graph
  • Priority Queue / Heap

Design Goals

  • Idiomatic Go
  • Datatype first
  • No external dependencies
  • Generic-friendly (Go 1.18+ ready)
  • Focus on clarity and correctness
  • Simple API surface

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages