Skip to content

Commit 789a92c

Browse files
Merge branch 'master' into add-prime-binary-string
2 parents 05f1a9c + c39d84b commit 789a92c

File tree

57 files changed

+865
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+865
-626
lines changed

CMakeLists.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ if(USE_OPENMP)
2727
endif()
2828
endif()
2929

30-
add_subdirectory(math)
31-
add_subdirectory(others)
32-
add_subdirectory(search)
33-
add_subdirectory(ciphers)
34-
add_subdirectory(hashing)
35-
add_subdirectory(strings)
36-
add_subdirectory(sorting)
37-
add_subdirectory(geometry)
38-
add_subdirectory(graphics)
39-
add_subdirectory(probability)
4030
add_subdirectory(backtracking)
4131
add_subdirectory(bit_manipulation)
32+
add_subdirectory(ciphers)
33+
add_subdirectory(cpu_scheduling_algorithms)
34+
add_subdirectory(data_structures)
35+
add_subdirectory(divide_and_conquer)
4236
add_subdirectory(dynamic_programming)
37+
add_subdirectory(games)
38+
add_subdirectory(geometry)
39+
add_subdirectory(graph)
40+
add_subdirectory(graphics)
4341
add_subdirectory(greedy_algorithms)
44-
add_subdirectory(range_queries)
45-
add_subdirectory(operations_on_datastructures)
46-
add_subdirectory(data_structures)
42+
add_subdirectory(hashing)
4743
add_subdirectory(machine_learning)
44+
add_subdirectory(math)
4845
add_subdirectory(numerical_methods)
49-
add_subdirectory(graph)
50-
add_subdirectory(divide_and_conquer)
51-
add_subdirectory(games)
52-
add_subdirectory(cpu_scheduling_algorithms)
46+
add_subdirectory(operations_on_datastructures)
47+
add_subdirectory(others)
5348
add_subdirectory(physics)
49+
add_subdirectory(probability)
50+
add_subdirectory(range_queries)
51+
add_subdirectory(search)
52+
add_subdirectory(sorting)
53+
add_subdirectory(strings)
5454

5555
cmake_policy(SET CMP0054 NEW)
5656
cmake_policy(SET CMP0057 NEW)

CONTRIBUTING.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,9 @@ static void test() {
204204
205205
/**
206206
* @brief Main function
207-
* @param argc commandline argument count (ignored)
208-
* @param argv commandline array of arguments (ignored)
209207
* @returns 0 on exit
210208
*/
211-
int main(int argc, char *argv[]) {
209+
int main() {
212210
test(); // run self-test implementations
213211
// code here
214212
return 0;

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
* [Shortest Common Supersequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/shortest_common_supersequence.cpp)
122122
* [Subset Sum Dynamic](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/subset_sum_dynamic.cpp)
123123
* [Trapped Rainwater](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/trapped_rainwater.cpp)
124+
* [Trapped Rainwater2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/trapped_rainwater2.cpp)
124125
* [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/tree_height.cpp)
125126
* [Unbounded 0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/unbounded_0_1_knapsack.cpp)
126127
* [Word Break](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/word_break.cpp)

ciphers/base64_encoding.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* digits.
1212
* @author [Ashish Daulatabad](https://github.com/AshishYUO)
1313
*/
14-
#include <array> /// for `std::array`
1514
#include <cassert> /// for `assert` operations
1615
#include <cstdint>
1716
#include <iostream> /// for IO operations

ciphers/hill_cipher.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ class HillCipher {
379379
int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt;
380380

381381
matrix<double> tmp_inverse = get_inverse(encrypt_key);
382-
double d2 = determinant_lu(decrypt_key);
383382

384383
// find co-prime factor for inversion
385384
int det_inv = -1;

ciphers/uint256_t.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class uint256_t {
7272
*/
7373
template <typename T, typename = typename std::enable_if<
7474
std::is_integral<T>::value, T>::type>
75-
explicit uint256_t(T low) : s(low), f(0) {}
75+
explicit uint256_t(T low) : f(0), s(low) {}
7676

7777
/**
7878
* @brief Parameterized constructor

data_structures/queue_using_array2.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
#include <iostream>
2-
using namespace std;
32

43
int queue[10];
54
int front = 0;
65
int rear = 0;
76

87
void Enque(int x) {
98
if (rear == 10) {
10-
cout << "\nOverflow";
9+
std::cout << "\nOverflow";
1110
} else {
1211
queue[rear++] = x;
1312
}
1413
}
1514

1615
void Deque() {
1716
if (front == rear) {
18-
cout << "\nUnderflow";
17+
std::cout << "\nUnderflow";
1918
}
2019

2120
else {
22-
cout << "\n" << queue[front++] << " deleted";
21+
std::cout << "\n" << queue[front++] << " deleted";
2322
for (int i = front; i < rear; i++) {
2423
queue[i - front] = queue[i];
2524
}
@@ -30,21 +29,21 @@ void Deque() {
3029

3130
void show() {
3231
for (int i = front; i < rear; i++) {
33-
cout << queue[i] << "\t";
32+
std::cout << queue[i] << "\t";
3433
}
3534
}
3635

3736
int main() {
3837
int ch, x;
3938
do {
40-
cout << "\n1. Enque";
41-
cout << "\n2. Deque";
42-
cout << "\n3. Print";
43-
cout << "\nEnter Your Choice : ";
44-
cin >> ch;
39+
std::cout << "\n1. Enque";
40+
std::cout << "\n2. Deque";
41+
std::cout << "\n3. Print";
42+
std::cout << "\nEnter Your Choice : ";
43+
std::cin >> ch;
4544
if (ch == 1) {
46-
cout << "\nInsert : ";
47-
cin >> x;
45+
std::cout << "\nInsert : ";
46+
std::cin >> x;
4847
Enque(x);
4948
} else if (ch == 2) {
5049
Deque();

data_structures/rb_tree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RBtree
3333
};
3434
void RBtree::insert()
3535
{
36-
int z, i = 0;
36+
int z;
3737
cout << "\nEnter key of the node to be inserted: ";
3838
cin >> z;
3939
node *p, *q;

data_structures/sparse_table.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ static void test() {
155155

156156
/**
157157
* @brief Main function
158-
* @param argc commandline argument count (ignored)
159-
* @param argv commandline array of arguments (ignored)
160158
* @returns 0 on exit
161159
*/
162-
int main(int argc, char *argv[]) {
160+
int main() {
163161
test(); // run self-test implementations
164162
return 0;
165163
}

data_structures/stack_using_array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Stack {
2525
*
2626
* @param size Maximum size of the stack
2727
*/
28-
Stack(int size) : stackSize(size), stackIndex(-1), stack(new T[size]) {}
28+
Stack(int size) : stack(new T[size]), stackSize(size), stackIndex(-1) {}
2929

3030
/**
3131
* @brief Checks if the stack is full

0 commit comments

Comments
 (0)