Skip to content

Commit f5b5e59

Browse files
github-actionsgithub-actions
github-actions
authored and
github-actions
committed
formatting source-code for 2a44ee3
1 parent 2a44ee3 commit f5b5e59

File tree

10 files changed

+32
-18
lines changed

10 files changed

+32
-18
lines changed

backtracking/graph_coloring.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bool isSafe(int v, bool graph[V][V], int color[], int c) {
2323

2424
/* A recursive utility function to solve m coloring problem */
2525
void graphColoring(bool graph[V][V], int m, int color[], int v) {
26-
// base case:
26+
// base case:
2727
// If all vertices are assigned a color then return true
2828
if (v == V) {
2929
printSolution(color);
@@ -74,7 +74,7 @@ int main() {
7474

7575
int color[V];
7676

77-
for (int i = 0; i < V; i++) {
77+
for (int i = 0; i < V; i++) {
7878
color[i] = 0;
7979
}
8080

backtracking/knight_tour.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main() {
5757
cout << "solution doesnot exist \n";
5858
} else {
5959
for (i = 0; i < n; i++) {
60-
for (j = 0; j < n; j++) {
60+
for (j = 0; j < n; j++) {
6161
cout << sol[i][j] << " ";
6262
}
6363
cout << "\n";

backtracking/n_queens.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
void printSolution(int board[N][N]) {
55
std::cout << "\n";
66
for (int i = 0; i < N; i++) {
7-
for (int j = 0; j < N; j++) {
7+
for (int j = 0; j < N; j++) {
88
std::cout << "" << board[i][j];
99
}
1010
std::cout << "\n";
@@ -54,7 +54,7 @@ void solveNQ(int board[N][N], int col) {
5454

5555
// recur to place rest of the queens
5656
solveNQ(board, col + 1);
57-
board[i][col] = 0; // BACKTRACK
57+
board[i][col] = 0; // BACKTRACK
5858
}
5959
}
6060
}

data_structures/doubly_linked_list.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ int main() {
156156
break;
157157

158158
default:
159-
if (choice == 0) { break; }
159+
if (choice == 0) {
160+
break;
161+
}
160162
std::cout << "Wrong option; type an option : ";
161163
std::cin >> choice;
162164

data_structures/linked_list.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ int main() {
151151
break;
152152

153153
default:
154-
if (choice == 0) { break; }
154+
if (choice == 0) {
155+
break;
156+
}
155157
std::cout << "Wrong option; type an option : ";
156158
std::cin >> choice;
157159

data_structures/list_array.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ int main() {
156156
break;
157157

158158
default:
159-
if (choice == 0) { break; }
159+
if (choice == 0) {
160+
break;
161+
}
160162
std::cout << "Wrong option; type an option : ";
161163
std::cin >> choice;
162164

data_structures/morrisinorder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ void morrisInorder(Btree *root) {
6060
// Left of current node is stored in temp
6161
temp = curr->left;
6262
// Moving to extreme right of temp
63-
while (temp->right && temp->right != curr) { temp = temp->right; }
63+
while (temp->right && temp->right != curr) {
64+
temp = temp->right;
65+
}
6466
// If extreme right is null it is made to point to currrent node
6567
// (will be used for backtracking)
6668
if (temp->right == nullptr) {
6769
temp->right = curr;
6870
// current node is made to point its left subtree
6971
curr = curr->left;
70-
// If extreme right already points to currrent node it it set to
71-
// null
72+
// If extreme right already points to currrent node it it set to
73+
// null
7274
} else if (temp->right == curr) {
7375
std::cout << curr->data << " ";
7476
temp->right = nullptr;
@@ -86,7 +88,7 @@ int main() {
8688
// Testing morrisInorder funtion
8789
Btree *root = nullptr;
8890
int i;
89-
for (i = 1; i <= 7; i++) {
91+
for (i = 1; i <= 7; i++) {
9092
insert(&root, i);
9193
}
9294
std::cout << "Morris Inorder: ";

data_structures/queue_using_array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int main() {
8181
data = ob.dequeue();
8282
std::cout << "\ndequeue element is:\t" << data;
8383
} else if (op == 3) {
84-
ob.display();
84+
ob.display();
8585
} else if (op == 4) {
8686
exit(0);
8787
} else {

data_structures/tree.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ int main() {
123123
break;
124124

125125
default:
126-
if (ch == 0) { break; }
126+
if (ch == 0) {
127+
break;
128+
}
127129
std::cout << "Wrong option; type an option : ";
128130
std::cin >> ch;
129131

data_structures/trie_tree.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <iostream>
55
#include <string>
66

7-
/**
7+
/**
88
* structure definition
99
*/
1010
typedef struct trie {
@@ -17,12 +17,14 @@ typedef struct trie {
1717
*/
1818
trie* createNode() {
1919
trie* nn = new trie();
20-
for (int i = 0; i < 26; i++) { nn->arr[i] = nullptr; }
20+
for (int i = 0; i < 26; i++) {
21+
nn->arr[i] = nullptr;
22+
}
2123
nn->isEndofWord = false;
2224
return nn;
2325
}
2426

25-
/**
27+
/**
2628
* insert string into the trie
2729
*/
2830
void insert(trie* root, std::string str) {
@@ -66,7 +68,9 @@ bool deleteString(trie* root, std::string str, int index) {
6668
return false;
6769
}
6870
root->isEndofWord = false;
69-
for (int i = 0; i < 26; i++) { return false; }
71+
for (int i = 0; i < 26; i++) {
72+
return false;
73+
}
7074
return true;
7175
}
7276
int j = str[index] - 'a';

0 commit comments

Comments
 (0)