Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d4962c3

Browse files
vil02realstealthninja
andauthored
style: remove unused variables (TheAlgorithms#2946)
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
1 parent 3f0409d commit d4962c3

File tree

12 files changed

+11
-15
lines changed

12 files changed

+11
-15
lines changed

‎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;

‎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;

‎dynamic_programming/maximum_circular_subarray.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ static void test() {
6767
// Output: 22
6868
// Explanation: Subarray 12, 8, -8, 9, -9, 10 gives the maximum sum, that is 22.
6969

70-
int n = 7; // size of the array
7170
std::vector<int> arr = {8, -8, 9, -9, 10, -11, 12};
7271
assert(dynamic_programming::maxCircularSum(arr) == 22); // this ensures that the algorithm works as expected
7372

‎graph/hopcroft_karp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ using graph::HKGraph;
254254
*/
255255
void tests(){
256256
// Sample test case 1
257-
int v1a = 3, v1b = 5, e1 = 2; // vertices of left side, right side and edges
257+
int v1a = 3, v1b = 5; // vertices of left side, right side and edges
258258
HKGraph g1(v1a, v1b); // execute the algorithm
259259

260260
g1.addEdge(0,1);
@@ -266,7 +266,7 @@ void tests(){
266266
assert(res1 == expected_res1); // assert check to ensure that the algorithm executed correctly for test 1
267267

268268
// Sample test case 2
269-
int v2a = 4, v2b = 4, e2 = 6; // vertices of left side, right side and edges
269+
int v2a = 4, v2b = 4; // vertices of left side, right side and edges
270270
HKGraph g2(v2a, v2b); // execute the algorithm
271271

272272
g2.addEdge(1,1);
@@ -282,7 +282,7 @@ void tests(){
282282
assert(res2 == expected_res2); // assert check to ensure that the algorithm executed correctly for test 2
283283

284284
// Sample test case 3
285-
int v3a = 6, v3b = 6, e3 = 4; // vertices of left side, right side and edges
285+
int v3a = 6, v3b = 6; // vertices of left side, right side and edges
286286
HKGraph g3(v3a, v3b); // execute the algorithm
287287

288288
g3.addEdge(0,1);

‎hashing/double_hash_hash_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ using double_hashing::totalSize;
248248
* @returns 0 on success
249249
*/
250250
int main() {
251-
int cmd = 0, hash = 0, key = 0;
251+
int cmd = 0, key = 0;
252252
std::cout << "Enter the initial size of Hash Table. = ";
253253
std::cin >> totalSize;
254254
table = std::vector<Entry>(totalSize);

‎hashing/linear_probing_hash_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ using linear_probing::totalSize;
222222
* @returns 0 on success
223223
*/
224224
int main() {
225-
int cmd = 0, hash = 0, key = 0;
225+
int cmd = 0, key = 0;
226226
std::cout << "Enter the initial size of Hash Table. = ";
227227
std::cin >> totalSize;
228228
table = std::vector<Entry>(totalSize);

‎hashing/quadratic_probing_hash_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ using quadratic_probing::totalSize;
244244
* @returns None
245245
*/
246246
int main() {
247-
int cmd = 0, hash = 0, key = 0;
247+
int cmd = 0, key = 0;
248248
std::cout << "Enter the initial size of Hash Table. = ";
249249
std::cin >> totalSize;
250250
table = std::vector<Entry>(totalSize);

‎machine_learning/kohonen_som_trace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace machine_learning {
103103
void update_weights(const std::valarray<double> &x,
104104
std::vector<std::valarray<double>> *W,
105105
std::valarray<double> *D, double alpha, int R) {
106-
int j = 0, k = 0;
106+
int j = 0;
107107
int num_out = W->size(); // number of SOM output nodes
108108
// int num_features = x.size(); // number of data features
109109

‎machine_learning/ordinary_least_squares_regressor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@ std::vector<float> predict_OLS_regressor(std::vector<std::vector<T>> const &X,
367367

368368
/** Self test checks */
369369
void ols_test() {
370-
int F = 3, N = 5;
371-
372370
/* test function = x^2 -5 */
373371
std::cout << "Test 1 (quadratic function)....";
374372
// create training data set with features = x, x^2, x^3

‎numerical_methods/successive_approximation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static float eqd(float y) { return 0.5 * (cos(y) + 2); }
1818

1919
/** Main function */
2020
int main() {
21-
float y, x1, x2, x3, sum, s, a, f1, f2, gd;
21+
float y, x1, x2, sum;
2222
int i, n;
2323

2424
for (i = 0; i < 10; i++) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /