Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zedthree/fortran-redblack
Demos of Red-Black and Binary Search Trees in Fortran
https://github.com/zedthree/fortran-redblack
data-structures fortran redblacktree tree-structure
Last synced: 9 days ago
JSON representation
Demos of Red-Black and Binary Search Trees in Fortran
- Host: GitHub
- URL: https://github.com/zedthree/fortran-redblack
- Owner: ZedThree
- Created: 2018-12-23T12:46:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-23T17:26:24.000Z (about 6 years ago)
- Last Synced: 2025-01-09T08:33:54.419Z (18 days ago)
- Topics: data-structures, fortran, redblacktree, tree-structure
- Language: Fortran
- Size: 26.4 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Red-Black and Binary Search Trees in Fortran
This repo contains two modules with implementations of red-black and
binary search trees. I wrote them purely as a learning exercise and
not for actual use, so they only store integers. For an actually
useful associative container, they would need to store key-value
pairs.## Examples
Use of either type of tree goes as follows:
use binary_tree
implicit nonetype(binary_tree_t) :: tree
call tree%add(4)
call tree%add(5)
call tree%add(3)print*, tree%values()
## Tests
pFUnit is bundled as a submodule. You may need to run the following
command to get it:git submodule update --init --recursive
Then build it like:
mkdir externals/build_pfunit
cd externals/build_pfunit
cmake ../pFUnit/ -DMPI=NO -DOPENMP=NO \
-DCMAKE_INSTALL_PREFIX=../install_pfunit
make && make installThen you can build and run the tests like:
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=$(pwd)/../externals/install_pfunit/
make && ctest --verbose