Skip to content
/ goTree Public

AVL and RedBlack binary tree implementation in Go

License

Notifications You must be signed in to change notification settings

raffOps/goTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Coverage Go Report Card

goTree

On this project I implement a tree data structure in Go for 2 types of self-balancing trees:

For the AVL Tree I implemented the following methods:

  • Insert
  • Delete
  • Search
  • Preorder
  • Height
  • String

For the Red-Black Tree I implemented the following methods:

  • Insert
  • Search
  • Preorder
  • Height
  • String_

Both trees are generic, so they can be used with any type of data, as long as the type implements the interface Comparable.

Setup

Just install Go 1.21 and clone the repository. Golang automatically downloads the dependencies.

Run main with some examples

go run cmd/main.go

Run tests

go test ./...

Future work

  • Implement the other methods for the AVL Tree and Red-Black Tree
  • Create a interface shared both by the AVL Tree and Red-Black Tree
  • Implement a dictionary of suffixes using the implemented trees, comparing the performance between them for different operations.