This project contains all the explorations done in C++ language at work. It is organized into following projects:
1. Binary Tree - Contains the implementations of binary tree algorithms
2. Linked List - Contains the implementations for some of the common problems of Linked Lists.
3. Design Patterns - Contains the implementations for commonly known Design Patterns
4. Learning Programming - Contains the explorations of various contructs of C++ language, include C++11 features, Template Metaprogramming concepts.
5. Exploring C++14 - Explorations of features of C++ 14, along with functional programming concepts like Continuation Passing Style etc.
6. Performance Experiments - Contains the benchmarking code for seemingly simple code, and tries to obtain the average time taken by a function.
Prerequisites:
- C++14 or later compiler. For example on windows, requires MSVC 2017 or later for successful compilation.
- Boost libraries >= 1.59.
- Poco libraries >= 1.7.8
- CMake >= 3.9
- NSIS: Nullsoft Scriptable Install System >= 3.02.1 if you need to create packages for Windows.
- If on Windows, then install VS 2017 with Linux Development package to enable cross platform development from Windows itself.
Steps for setup
- Make sure that cmake is installed and added to path.
For eg. if you type "cmake" at command prompt it should print details and quit.
- Define Environment variable "POCO" and have it pointed to the path where it is installed.
For building Poco on windows, refer to the section below.
-
Define Environment variables "BOOST_ROOT", "BOOST_INCLUDEDIR", "BOOST_LIBRARYDIR" as follows:
For example, assume that boost libraries are extracted to the following folder: C:\local\boost_1_64_0.
Then define
BOOST_ROOT=C:/local/boost_1_64_0
BOOST_INCLUDEDIR=${BOOST_ROOT}/boost/ or C:/local/boost_1_64_0/boost/
BOOST_LIBRARYDIR=${BOOST_ROOT}/lib64-msvc-14.1 or C:/local/boost_1_64_0/lib64-msvc-14.1/
Please note that "lib64-msvc-14.1" folder could change based on 32bit/64bit libraries and also the msvc compiler used to compile the boost libraries.
Also, boost_1_64_0 could also change as per the version of the boost that has been downloaded.
4. It is recommended to setup VS to work with CMake projects as described here: https://docs.microsoft.com/en-us/cpp/linux/cmake-linux-project?view=vs-2017
Steps for Linux setup with VS remote debugging enabled
- Install VMware/VirtualBox, and then install a linux distro of your choice, although the steps mentioned here have been tested on Ubuntu.
- Follow the instructions from this page: https://blogs.msdn.microsoft.com/vcblog/2018/11/26/using-visual-studio-for-cross-platform-c-development-targeting-windows-and-linux/
- To enable connection from VS, follow the steps from this page: https://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet
- Build and Run from CMake menu item in VS toolbar.
Steps for building Poco:
- Goto this site to download the poco sources: https://pocoproject.org/
- Download the sources for Basic Edition, since there are no other dependent libraries needed to build.
- Extract to a suitable folder, and then run cmake with either of the following command for building with MSVC 2017(depending on the debug/release builds, although it is recommended to build both):
cmake -G "Visual Studio 15" -DENABLE_MONGODB=OFF -DENABLE_ZIP=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF -DENABLE_DATA=OFF <path to="" sources="">
or
cmake -G "Visual Studio 15" -DCMAKE_BUILD_TYPE="Debug" -DENABLE_MONGODB=OFF -DENABLE_ZIP=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF -DENABLE_DATA=OFF <path to="" sources=""></path></path>
- Open the corresponding VS project and hit build.
- Once the build is complete, run the "INSTALL" project, and the poco libraries should be copied to C:\Program Files (x86)\Poco.
Please note that if you did a 64 bit build, then the location would change to C:\Program Files\Poco
- Define an environment variable POCO which points to the path where the binaries are copied.
Tasks TODO
- Create a setup script that will download all the prerequisite software, installs it and finally generates project files using CMake. In short, make it trivial to setup project.
- Implement Thread pipeline model.
- Add recently attended interview questions from Amazon, National Instruments etc into the projects.
- Implement Interval Trees and the relevant question from Amazon to solve.
- Rename BinaryTrees module to Trees to include all kinds of Tree implementations.
- Expand the Trees module to include implementations for the following:
- Interval Trees.
- Redblack Trees
- AVL Trees.
- B-Trees
- B+ Trees
- Suffix Trees
- Tries
- Finish all the 18 problems in the Linked List module.
- Create a wheel file for the python algorithms project, which will allow to import all the algorithm modules.
- Figure out a better way to maintain the TODO list if possible.
- Simplify CMake build files.
- Download and configure Boost, Poco, etc for Linux and Mac.
Tasks Done
- Remove unused files from the code base - from Codeland_Solution folder.
- Figure out parameter passing in CMake functions and pass only those libraries required to be copied for Qt projects.
- Make a CPack installer for windows covering following:
- Learning_Programming.exe
- Napa_Solution.exe
- Client.exe
- Server.exe
- Fix runtime issues in Codeland Solution.
- Add all the ui files into its own folder and resource files into their own folders.
- Moved all the Interview Questions Solutions files into its own project.
- Made the project truly cross-platform (Windows, Linux and Mac) by fixing all the compiler errors and CMake issues.
- Since VS 2017 and later supports CMake projects, "Add all the CMakelists files, License file and other text files to the project" is taken care of.
- Finished modernizing BinaryTree module. Now BinTree is just a thin wrapper, and the core BinaryTree functions are implemented in BinaryTreeProblems.
Project Members: