Skip to content

Commit ee83696

Browse files
authored
Merge pull request #69 from Debashis08/release
Release
2 parents 6814ba1 + e69b4b0 commit ee83696

20 files changed

+175
-132
lines changed

.clang-tidy

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Checks: >
2+
readability-identifier-naming
3+
4+
WarningsAsErrors: '*'
5+
6+
HeaderFilterRegex: '(Headers/.*|SourceCodes/.*)'
7+
8+
CheckOptions:
9+
# Private member variables
10+
- key: readability-identifier-naming.PrivateMemberPrefix
11+
value: _
12+
- key: readability-identifier-naming.PrivateMemberCase
13+
value: camelBack
14+
15+
# Member function (non-static, non-const, non-virtual)
16+
- key: readability-identifier-naming.MethodCase
17+
value: CamelCase
18+
19+
# Class names
20+
- key: readability-identifier-naming.ClassCase
21+
value: CamelCase
22+
23+
# Optional, but ensures errors are reported instead of silently skipped
24+
- key: readability-identifier-naming.IgnoreFailures
25+
value: false
26+
- key: readability-identifier-naming.IgnoreFailedSplit
27+
value: false
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: datastructures-algorithms-ci-cd
2+
3+
on:
4+
push:
5+
branches: [ main, release ]
6+
pull_request:
7+
branches: [ main, release ]
8+
9+
jobs:
10+
lint-build-test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y cmake libgtest-dev clang-tidy
21+
22+
- name: Configure CMake
23+
run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
24+
25+
- name: Run clang-tidy
26+
run: |
27+
find Headers -name '*.h' -o -name '*.hpp' ; find SourceCodes -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \
28+
xargs clang-tidy -p build --warnings-as-errors=*
29+
30+
- name: Build
31+
run: cmake --build build
32+
33+
- name: Run tests
34+
run: ctest --test-dir build --output-on-failure

.github/workflows/dsa-ci.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
# CMakeList.txt : CMake project for DataStructures_Algorithms, include source and define
2-
# project specific logic here.
3-
#
4-
cmake_minimum_required (VERSION 3.8)
5-
6-
# Enable Hot Reload for MSVC compilers if supported.
7-
if (POLICY CMP0141)
8-
cmake_policy(SET CMP0141 NEW)
9-
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
10-
endif()
11-
12-
project ("DataStructures_Algorithms")
1+
# CMakeList.txt : CMake for datastructures-algorithms
2+
cmake_minimum_required (VERSION 3.10)
3+
project ("datastructures-algorithms")
134

145
set(CMAKE_CXX_STANDARD 14)
156
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8+
9+
10+
# .clang-tidy settp
11+
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
12+
if(CLANG_TIDY_EXE)
13+
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
14+
set(CMAKE_CXX_CLANG_TIDY
15+
"${CLANG_TIDY_EXE}"
16+
"--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy"
17+
"--extra-arg-before=-Wno-unknown-warning-option"
18+
"--extra-arg-before=-Wno-c++98-compat-pedantic"
19+
"--quiet"
20+
)
21+
endif()
1622

1723
include_directories(${CMAKE_SOURCE_DIR}/Headers)
1824

@@ -24,9 +30,10 @@ FetchContent_Declare(
2430
googletest
2531
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
2632
)
33+
2734
# For Windows: Prevent overriding the parent project's compiler/linker settings
2835
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
2936

3037
enable_testing()
3138

32-
add_subdirectory(Tests)
39+
add_subdirectory(Tests)

CMakePresets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"binaryDir": "${sourceDir}/Build/build/${presetName}",
99
"installDir": "${sourceDir}/Build/install/${presetName}",
1010
"cacheVariables": {
11-
"CMAKE_C_COMPILER": "cl.exe",
12-
"CMAKE_CXX_COMPILER": "cl.exe"
11+
"CMAKE_C_COMPILER": "gcc",
12+
"CMAKE_CXX_COMPILER": "g++"
1313
},
1414
"condition": {
1515
"type": "equals",

Headers/0002_Tree/0001_BinarySearchTree.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ namespace BinarySearchTree
2121
{
2222
private:
2323
Node* _root;
24-
void _InsertNode(Node* node);
25-
Node* _FindNode(int value);
26-
Node* _FindMinimumValueNode(Node* node);
27-
Node* _FindMaximumValueNode(Node* node);
28-
Node* _FindSuccessorNode(Node* node);
29-
Node* _FindPredecessorNode(Node* node);
30-
void _Transplant(Node* nodeU, Node* nodeV);
31-
void _DeleteNode(Node* node);
32-
void _RecursiveInorderTraversal(Node* node, vector<int>& result);
33-
void _RecursivePreorderTraversal(Node* node, vector<int>& result);
34-
void _RecursivePostorderTraversal(Node* node, vector<int>& result);
35-
void _MorrisInorderTraversal(Node* node, vector<int>& result);
36-
void _MorrisPreorderTraversal(Node* node, vector<int>& result);
37-
void _MorrisPostorderTraversal(Node* node, vector<int>& result);
24+
void InsertBinarySearchTreeNode(Node* node);
25+
Node* FindBinarySearchTreeNode(int value);
26+
Node* FindBinarySearchTreeMinimumValueNode(Node* node);
27+
Node* FindBinarySearchTreeMaximumValueNode(Node* node);
28+
Node* FindSuccessorBinarySearchTreeNode(Node* node);
29+
Node* FindPredecessorBinarySearchTreeNode(Node* node);
30+
void TransplantBinarySearchTreeNode(Node* nodeU, Node* nodeV);
31+
void DeleteBinarySearchTreeNode(Node* node);
32+
void RecursiveInorderTraversal(Node* node, vector<int>& result);
33+
void RecursivePreorderTraversal(Node* node, vector<int>& result);
34+
void RecursivePostorderTraversal(Node* node, vector<int>& result);
35+
void MorrisInorderTraversal(Node* node, vector<int>& result);
36+
void MorrisPreorderTraversal(Node* node, vector<int>& result);
37+
void MorrisPostorderTraversal(Node* node, vector<int>& result);
3838
public:
3939
BinarySearchTree();
4040
void InsertNode(int value);

Headers/0003_Graph/0002_DepthFirstSearch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace DepthFirstSearch
2424
class Graph
2525
{
2626
private:
27-
int time;
27+
int _time;
2828
map<Node*, list<Node*>> _adjlist;
2929
map<int, Node*> _nodeMap;
3030
Node* MakeOrFindNode(int value);

Headers/0003_Graph/0003_TopologicalSort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace TopologicalSort
2525
class Graph
2626
{
2727
private:
28-
int time;
29-
bool hasCycle;
28+
int _time;
29+
bool _hasCycle;
3030
map<Node*, list<Node*>> _adjlist;
3131
map<int, Node*> _nodeMap;
3232
list<Node*> _topologicalSortedNodeList;

Headers/0003_Graph/0004_StronglyConnectedComponents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace StronglyConnectedComponents
2424
class Graph
2525
{
2626
private:
27-
int time;
27+
int _time;
2828
map<Node*, list<Node*>> _adjlistG;
2929
map<Node*, list<Node*>> _adjlistT;
3030
map<int, Node*> _nodeMap;

SourceCodes/0001_Basics/Node.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "../Headers/0001_Basics/Node.h"
2-
using namespace std;
32

43
Node::Node()
54
{

0 commit comments

Comments
 (0)