Skip to content

Commit

Permalink
docs: updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
raffOps committed Dec 19, 2023
1 parent 88eb692 commit d36ca2a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ go.work
/.idea/git_toolbox_prj.xml
/.idea/gotree.iml
/.idea/modules.xml
/.idea/vcs.xml
/.idea
52 changes: 50 additions & 2 deletions README.md
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.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {

tree := redblacktree.NewRedBlackTree[int]()
r := rand.New(rand.NewSource(1))
arr := r.Perm(10)
arr := r.Perm(100)
for _, value := range arr {
fmt.Printf("%d ", value)
tree = redblacktree.Insert(tree, value)
Expand Down

0 comments on commit d36ca2a

Please sign in to comment.