This project contains all the explorations done in C++ language at work. It is organized into following projects:
- Binary Tree - Contains the implementations of binary tree algorithms
- Linked List - Contains the implementations for some of the common problems of Linked Lists.
- Design Patterns - Contains the implementations for commonly known Design Patterns
- Learning Programming - Contains the explorations of various contructs of C++ language, include C++11 features, Template Metaprogramming concepts.
- Exploring C++14 - Explorations of features of C++ 14, along with functional programming concepts like Continuation Passing Style etc.
- Performance Experiments - Contains the benchmarking code for seemingly simple code, and tries to obtain the average time taken by a function.
- Interview_Questions_Solutions contains code related to programming questions asked in various interviews, with each company's questions organized into its own project. Currently the following projects are present
- TAS - Diophantine
- Amazon
- NVidia
- Codeland
- Napa
Prerequisites:
- C++14 or later compiler. For example on windows, requires MSVC 2015 or later for successful compilation.
- Boost libraries >= 1.59.
- Poco libraries >= 1.7.8
- CMake >= 3.5
- Zlib and LibPng if building ImageProcess library.
- Qt >= 5.9.1 if building Napa_Solution and CodeLand_Solution
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.
-
Define Environment Variable "QT_DIR" as follows:
For example, assume that Qt is located in the following folder: C:\Qt\5.9.1\
Then define
QT_DIR=C:\Qt\5.9.1\msvc2015_64
where "msvc2015_64" represents the compiler and the architecture against which the Qt libraries have been built.
Please note that, the build may fail if there is any configuration mismatch.
- If ImageProcess library is being built, please refer to sections: "Steps for building ZLIB" and "Steps for building LibPng", as the ImageProcess library
depends on them.
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.
Steps for building ZLIB:
- Goto http://www.zlib.net/ to get the latest sources.
- Make a directory called build (or any other directory) and run cmake -G "Visual Studio 15" -DCMAKE_BUILD_TYPE="Debug" <path to="" zlib="" source="" containing="" cmakelists.txt=""></path>
- Make sure to run the install command once the build is finished. This will copy the includes and libraries to "C:\Program Files (x86)\zlib" on windows. On other platforms, the
appropriate installation directories will be chosen. Also, if the build is 64 bit, then the path will be changed to "C:\Program Files\zlib".
Please note that, you may need to run with admin privileges/root persmissions for the install command to succeed.
- Now, define an environment variable ZLIB_ROOT, and have it point to the directory where the files in the previous step were copied.
Steps for building LibPng:
- LibPng needs Zlib, so please follow the steps mentioned in the section "Steps for building ZLIB" before proceeding further.
- Goto http://www.libpng.org/pub/png/libpng.html and get the latest soureces.
- Make a directory called build (or any other directory) and run cmake -G "Visual Studio 15" -DCMAKE_BUILD_TYPE="Debug" -DZLIB_LIBRARY=<path to="" the="" zlib="" library,="" including="" file="" name="" eg.="" zlib.lib=""> -DZLIB_INCLUDE_DIR=<path to="" the="" zlib="" include="" directory=""> <path to="" libpng="" sources="">
Please note that the path to ZLib Library should include the filename as well, otherwise, the cmake build could fail with unresolved externals.</path></path></path>
- Make sure to run the install command once the build is finished. The same caveats as in the earlier section ("Steps for building ZLib") will apply here as well.
- Now, define an environment variable LIBPNG_ROOT, and have it point to the directory where the files in the previous step were copied.
Project Members: