https://github.com/haidaram/bst
Implementation of some Binary Search Trees in C
https://github.com/haidaram/bst
Last synced: 3 months ago
JSON representation
Implementation of some Binary Search Trees in C
- Host: GitHub
- URL: https://github.com/haidaram/bst
- Owner: haidaraM
- License: mit
- Created: 2015-12-18T18:39:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-28T18:03:30.000Z (about 8 years ago)
- Last Synced: 2025-02-04T21:49:25.801Z (4 months ago)
- Language: C
- Size: 339 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# BST
Implementation of some Binary Search Trees in C[](https://travis-ci.org/haidaraM/bst)
## Trees
The following BST are implemented :
- AVL
- Red–black treeThe implementation is chosen at the compile time by specifying a MACRO. Check the `CMakeLists.txt` file.
**By default AVL is chosen.**## Collection
There is generic collection defined. The collection will contain some **Element** which is just a `typedef int`.## Tree drawing
### ASCII
You can draw the tree in ASCII with the function `show_collection_in_ascii` :
```
355
/ \
/ \
/ \
/ \
/ \
81 444
/ \ / \
/ \ / \
28 284 / \
409 624
/ / \
400 / \
467 759
```### GraphViz
You can also draw with Graphviz. The function `create_dot_file_for_collection` create a dot file which can be interpreted by the
`dot` command. Example :
```bash
# Create an SVG representing the tree
dot -Tsvg generatedFile > tree_in_svg.svg
```
### TODO
- Use a key/value system to store element in collection
- Implement remove element function
- Benchmark