Advanced Programming - Binary Search Tree
A simple Binary Search Tree implementation for the Advanced Programming 2019-2020 course @ SISSA.
|
A simple Binary Search Tree implementation for the Advanced Programming 2019-2020 course @ SISSA.
We include a standard Makefile
for convenience, so you can run the usual make
commands; out-of-source build are not supported.
It is also possible to generate the Makefile
via qmake
by opening a terminal in the source code folder and running
mkdir build && cd build # If you'd like to, not compulsory qmake .. make
In both cases, if everything goes as it should, you now have an executable AP_BST
in your build folder $BLD
. You can run it via
./AP_BST
Notes:
make EXTRA_CXXFLAGS=-D__DEBUG_AP_BST
qmake CONFIG+=debug && make
qmake
step, depending on your system configuration. Examples:qmake -spec linux-g++
if you want to compile with GNU G++, while use qmake -spec linux-icc
if you want to use Intel's IC(P)C.qmake -spec macx-g++ QMAKE_CXX=/path/to/g++ QMAKE_LINK=/path/to/g++
if you want to compile with GNU G++, while use qmake -spec macx-icc
if you want to use Intel's IC(P)C. Notice that, if you want to compile with GNU G++, you also have to manually specify the two extra variables QMAKE_CXX
and QMAKE_LINK
; while in the other cases it's not necessary, in this case it is because otherwise MacOS will pick Apple's LLVM G++ by default (which is basically Clang).QMAKE_CXX
and QMAKE_LINK
(e.g. if you want to select a version of G++ different from the default one or in a non-standard location). You can also do this step in the make
step, but you have to specify the extra variables without the "QMAKE" (e.g. make CXX=/path/to/g++ LINK=/path/to/g++
).You can build the documentation by running
make doc
The documentation is built into the folder $BLD/doc/_build/
, where $BLD
is your build folder.
You can build the unit tests (written in Catch2) via
make test
in the $SRC
directory, where $SRC
is the directory that contains main.cpp
, or via
qmake && make
in the $SRC/test
directory. A binary test
is generated in the $SRC/test
directory, and you can run it with
./test
Refer to ./test --help
for a list of all the possible options for the test executable. E.g. the -s
option lists even the successful tests.
The sample program, that shows how to use the library, can be run in the following way:
./AP_BST
The tests, if compiled, can be run via
cd test ./test