Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Checks: >

WarningsAsErrors: '*'

HeaderFilterRegex: '(Headers/.*|SourceCodes/.*)'
HeaderFilterRegex: '(include/.*|source/.*)'

CheckOptions:
# Private member variables
Expand All @@ -24,4 +24,4 @@ CheckOptions:
- key: readability-identifier-naming.IgnoreFailures
value: false
- key: readability-identifier-naming.IgnoreFailedSplit
value: false
value: false
2 changes: 1 addition & 1 deletion .github/workflows/datastructures-algorithms-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Run clang-tidy
run: |
find Headers -name '*.h' -o -name '*.hpp' ; find SourceCodes -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \
find include -name '*.h' -o -name '*.hpp' ; find source -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \
xargs clang-tidy -p build --warnings-as-errors=*

- name: Build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vs/
Build/
build/
install/
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


# .clang-tidy settp
# .clang-tidy setup
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
if(CLANG_TIDY_EXE)
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(CMAKE_CXX_CLANG_TIDY
set(CLANG_TIDY_COMMAND
"${CLANG_TIDY_EXE}"
"--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy"
"--extra-arg-before=-Wno-unknown-warning-option"
Expand All @@ -19,10 +19,10 @@ if(CLANG_TIDY_EXE)
)
endif()

include_directories(${CMAKE_SOURCE_DIR}/Headers)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_subdirectory(Headers)
add_subdirectory(SourceCodes)
add_subdirectory(include)
add_subdirectory(source)

cmake_policy(SET CMP0135 NEW)
include(FetchContent)
Expand All @@ -36,4 +36,4 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

enable_testing()

add_subdirectory(Tests)
add_subdirectory(test)
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/Build/build/${presetName}",
"installDir": "${sourceDir}/Build/install/${presetName}",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This repository contains a collection of **data structures and algorithms** impl

```plain text
datastructures-algorithms
├── Headers # Header Files
├── SourceCodes # Implementation of the solutions
├── Tests # Unit tests for implemented solutions
├── include # Header Files
├── source # Implementation of the solutions
├── test # Unit tests for implemented solutions
└── CMakeLists.txt # CMake configuration file
```
6 changes: 0 additions & 6 deletions SourceCodes/0001_Basics/Node.cc

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(0001BASICS_SOURCES
)

# Create a library target
add_library(0001Basics ${0001BASICS_SOURCES})
add_library(0001BASICS ${0001BASICS_SOURCES})
6 changes: 6 additions & 0 deletions source/0001_Basics/Node.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "../include/0001_Basics/Node.h"

Node::Node()
{
value = 8;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0002_Tree/0001_BinarySearchTree.h"
#include "../include/0002_Tree/0001_BinarySearchTree.h"
#include<iostream>
#include<algorithm>
using namespace std;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0001_BreadthFirstSearch.h"
#include "../include/0003_Graph/0001_BreadthFirstSearch.h"
#include<iostream>
#include<queue>
#include<vector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0002_DepthFirstSearch.h"
#include "../include/0003_Graph/0002_DepthFirstSearch.h"
#include<vector>
#include<utility>
#include<climits>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0003_TopologicalSort.h"
#include "../include/0003_Graph/0003_TopologicalSort.h"
#include<vector>
#include<queue>
#include<utility>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0004_StronglyConnectedComponents.h"
#include "../include/0003_Graph/0004_StronglyConnectedComponents.h"
#include<vector>
#include<utility>
#include<climits>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0005_HamiltonianPathAndCycle.h"
#include "../include/0003_Graph/0005_HamiltonianPathAndCycle.h"

using namespace std;
namespace HamiltonianPathAndCycle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0006_EulerianPathAndCircuit.h"
#include "../include/0003_Graph/0006_EulerianPathAndCircuit.h"
#include<stack>
#include<algorithm>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0007_MinimumSpanningTreeKruskalAlgorithm.h"
#include "../include/0003_Graph/0007_MinimumSpanningTreeKruskalAlgorithm.h"
#include<climits>
#include<algorithm>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0008_MinimumSpanningTreePrimAlgorithm.h"
#include "../include/0003_Graph/0008_MinimumSpanningTreePrimAlgorithm.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0009_SingleSourceShortestPathBellmanFord.h"
#include "../include/0003_Graph/0009_SingleSourceShortestPathBellmanFord.h"
#include<climits>
#include<algorithm>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0010_DirectedAcyclicGraphShortestPath.h"
#include "../include/0003_Graph/0010_DirectedAcyclicGraphShortestPath.h"
#include<climits>
#include<algorithm>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0011_SingleSourceShortestPathDijkstra.h"
#include "../include/0003_Graph/0011_SingleSourceShortestPathDijkstra.h"
#include<climits>
#include<algorithm>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include"../Headers/0003_Graph/0012_DifferenceConstraintsShortestPaths.h"
#include"../include/0003_Graph/0012_DifferenceConstraintsShortestPaths.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0013_AllPairsShortestPathsFloydWarshall.h"
#include "../include/0003_Graph/0013_AllPairsShortestPathsFloydWarshall.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0014_AllPairsShortestPathsJohnson.h"
#include "../include/0003_Graph/0014_AllPairsShortestPathsJohnson.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0015_MaximumFlowFordFulkerson.h"
#include "../include/0003_Graph/0015_MaximumFlowFordFulkerson.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0016_MaximumFlowEdmondsKarp.h"
#include "../include/0003_Graph/0016_MaximumFlowEdmondsKarp.h"
#include<climits>
#include<queue>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0017_MaximumBipartiteMatching.h"
#include "../include/0003_Graph/0017_MaximumBipartiteMatching.h"
#include<climits>
#include<queue>
using namespace std;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0018_MaximumFlowGoldbergGenericPushRelabel.h"
#include "../include/0003_Graph/0018_MaximumFlowGoldbergGenericPushRelabel.h"
#include<climits>
using namespace std;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../Headers/0003_Graph/0019_MaximumFlowRelabelToFront.h"
#include "../include/0003_Graph/0019_MaximumFlowRelabelToFront.h"
#include<climits>
#include<iterator>
using namespace std;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ FetchContent_MakeAvailable(googletest)
enable_testing()

add_executable(
0001-Basics-Tests
0001BasicsTests
NodeTest.cc)

target_link_libraries(
0001-Basics-Tests
0001BasicsTests
GTest::gtest_main
0001BASICS
)

target_link_libraries(
0001-Basics-Tests
0001Basics
)

# Add .clang-tidy configuration to this library.
if(CLANG_TIDY_EXE)
set_target_properties(0001BASICS PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
endif()

include(GoogleTest)
gtest_discover_tests(0001-Basics-Tests DISCOVERY_TIMEOUT 30)
gtest_discover_tests(0001BasicsTests DISCOVERY_TIMEOUT 30)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include "../Headers/0001_Basics/Node.h"
#include "../include/0001_Basics/Node.h"

// Demonstrate some basic assertions.
namespace NodeTesting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include<string>
#include "../Headers/0002_Tree/0001_BinarySearchTree.h"
#include "../include/0002_Tree/0001_BinarySearchTree.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace BinarySearchTree
Expand Down
10 changes: 8 additions & 2 deletions Tests/0002_Tree/CMakeLists.txt → test/0002_Tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@ FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)


enable_testing()

add_executable(
0002TreeTests
0001_BinarySearchTreeTest.cc)
0001_BinarySearchTreeTest.cc
)

target_link_libraries(
0002TreeTests
GTest::gtest_main
0002TREE
)

# Add .clang-tidy configuration to this library.
if(CLANG_TIDY_EXE)
set_target_properties(0002TREE PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
endif()

include(GoogleTest)
gtest_discover_tests(0002TreeTests DISCOVERY_TIMEOUT 30)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include<string>
#include "../Headers/0003_Graph/0001_BreadthFirstSearch.h"
#include "../include/0003_Graph/0001_BreadthFirstSearch.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace BreadthFirstSearch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0002_DepthFirstSearch.h"
#include "../include/0003_Graph/0002_DepthFirstSearch.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace DepthFirstSearch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0003_TopologicalSort.h"
#include "../include/0003_Graph/0003_TopologicalSort.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace TopologicalSort
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0004_StronglyConnectedComponents.h"
#include "../include/0003_Graph/0004_StronglyConnectedComponents.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace StronglyConnectedComponents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0005_HamiltonianPathAndCycle.h"
#include "../include/0003_Graph/0005_HamiltonianPathAndCycle.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace HamiltonianPathAndCycle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0006_EulerianPathAndCircuit.h"
#include "../include/0003_Graph/0006_EulerianPathAndCircuit.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace EulerianPathAndCircuit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0007_MinimumSpanningTreeKruskalAlgorithm.h"
#include "../include/0003_Graph/0007_MinimumSpanningTreeKruskalAlgorithm.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace MinimumSpanningTreeKruskalAlgorithm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0008_MinimumSpanningTreePrimAlgorithm.h"
#include "../include/0003_Graph/0008_MinimumSpanningTreePrimAlgorithm.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace MinimumSpanningTreePrimAlgorithm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0009_SingleSourceShortestPathBellmanFord.h"
#include "../include/0003_Graph/0009_SingleSourceShortestPathBellmanFord.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace SingleSourceShortestPathBellmanFord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0010_DirectedAcyclicGraphShortestPath.h"
#include "../include/0003_Graph/0010_DirectedAcyclicGraphShortestPath.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace DirectedAcyclicGraphShortestPath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include "../Headers/0003_Graph/0011_SingleSourceShortestPathDijkstra.h"
#include "../include/0003_Graph/0011_SingleSourceShortestPathDijkstra.h"
#include "../0000_CommonUtilities/UnitTestHelper.h"

namespace SingleSourceShortestPathDijkstra
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include<gtest/gtest.h>
#include"../Headers/0003_Graph/0012_DifferenceConstraintsShortestPaths.h"
#include"../include/0003_Graph/0012_DifferenceConstraintsShortestPaths.h"
#include"../0000_CommonUtilities/UnitTestHelper.h"
using namespace std;

Expand Down
Loading