-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ go.work | |
/.idea/git_toolbox_prj.xml | ||
/.idea/gotree.iml | ||
/.idea/modules.xml | ||
/.idea/vcs.xml | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,51 @@ | ||
[![Go Coverage](https://github.com/rjribeiro/goTree/wiki/coverage.svg)](.coverage.out) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/rjribeiro/gotree)](https://goreportcard.com/report/github.com/rjribeiro/gotree) | ||
[![Go Coverage](https://github.com/raffops/goTree/wiki/coverage.svg)](.coverage.out) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/raffops/gotree)](https://goreportcard.com/report/github.com/raffops/gotree) | ||
# goTree | ||
|
||
On this project I implement a tree data structure in Go for 2 types of self-balancing trees: | ||
|
||
- AVL Tree: https://en.wikipedia.org/wiki/AVL_tree | ||
- Red-Black Tree: https://en.wikipedia.org/wiki/Red%E2%80%93black_tree | ||
|
||
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 | ||
|
||
```bash | ||
go run cmd/main.go | ||
``` | ||
|
||
# Run tests | ||
|
||
```bash | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters