Skip to content

Binary Tree: Sample C++ code inspired by LeetCode

License

Notifications You must be signed in to change notification settings

bornalgo/BinaryTree

Repository files navigation

Binary Tree

Sample C++ code inspired by LeetCode

BinaryTree_Sample

BinaryTree is a library inspired by Maximum Width of Binary Tree and Print Binary Tree questions.

Features

  • Creates schematic of a binary tree
  • Evaluates the maximum width of a binary tree
  • Converts a vector to a binary tree
  • CMake is used to build the library
  • Batch script can be executed to create the make file and build the program in Windows
  • Bash script can be executed to create the make file and build the program in Linux
  • more to come ...

Prerequisites

  • g++ or any C++ compiler
  • cmake
  • make

Build

Windows

Execute the following command

.\buildWindows.bat

The following additional options can be provided

-source [SOURCE]      : source directory
-build [BUILD]        : build directory excluding operating system
-generator [GENERATOR]: generator for cmake
-compiler [COMPILER]  : compiler for cmake
-make [MAKE]          : make executable
-vcvarsall            : path to vcvarsall.bat to set the environment variables for visual studio
*                     : any cmake arguments
-- *                  : any make arguments

Linux

Execute the following command

./buildLinux.sh

The following additional options can be provided

-source [SOURCE]      : source directory
-build [BUILD]        : build directory excluding operating system
-generator [GENERATOR]: generator for cmake
-compiler [COMPILER]  : compiler for cmake
-make [MAKE]          : make executable
*                     : any cmake arguments
-- *                  : any make arguments