diff --git a/ciphers/hill_cipher.cpp b/ciphers/hill_cipher.cpp index d77a51c22b3..197a1286de1 100644 --- a/ciphers/hill_cipher.cpp +++ b/ciphers/hill_cipher.cpp @@ -379,7 +379,6 @@ class HillCipher { int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt; matrix tmp_inverse = get_inverse(encrypt_key); - double d2 = determinant_lu(decrypt_key); // find co-prime factor for inversion int det_inv = -1; diff --git a/data_structures/rb_tree.cpp b/data_structures/rb_tree.cpp index f2a51a30c20..c10712f51a9 100644 --- a/data_structures/rb_tree.cpp +++ b/data_structures/rb_tree.cpp @@ -33,7 +33,7 @@ class RBtree }; void RBtree::insert() { - int z, i = 0; + int z; cout << "\nEnter key of the node to be inserted: "; cin >> z; node *p, *q; diff --git a/dynamic_programming/maximum_circular_subarray.cpp b/dynamic_programming/maximum_circular_subarray.cpp index d32ac64e9b8..466fc317702 100644 --- a/dynamic_programming/maximum_circular_subarray.cpp +++ b/dynamic_programming/maximum_circular_subarray.cpp @@ -67,7 +67,6 @@ static void test() { // Output: 22 // Explanation: Subarray 12, 8, -8, 9, -9, 10 gives the maximum sum, that is 22. - int n = 7; // size of the array std::vector arr = {8, -8, 9, -9, 10, -11, 12}; assert(dynamic_programming::maxCircularSum(arr) == 22); // this ensures that the algorithm works as expected diff --git a/graph/hopcroft_karp.cpp b/graph/hopcroft_karp.cpp index d4e002948a7..2cb16dc2a2b 100644 --- a/graph/hopcroft_karp.cpp +++ b/graph/hopcroft_karp.cpp @@ -254,7 +254,7 @@ using graph::HKGraph; */ void tests(){ // Sample test case 1 - int v1a = 3, v1b = 5, e1 = 2; // vertices of left side, right side and edges + int v1a = 3, v1b = 5; // vertices of left side, right side and edges HKGraph g1(v1a, v1b); // execute the algorithm g1.addEdge(0,1); @@ -266,7 +266,7 @@ void tests(){ assert(res1 == expected_res1); // assert check to ensure that the algorithm executed correctly for test 1 // Sample test case 2 - int v2a = 4, v2b = 4, e2 = 6; // vertices of left side, right side and edges + int v2a = 4, v2b = 4; // vertices of left side, right side and edges HKGraph g2(v2a, v2b); // execute the algorithm g2.addEdge(1,1); @@ -282,7 +282,7 @@ void tests(){ assert(res2 == expected_res2); // assert check to ensure that the algorithm executed correctly for test 2 // Sample test case 3 - int v3a = 6, v3b = 6, e3 = 4; // vertices of left side, right side and edges + int v3a = 6, v3b = 6; // vertices of left side, right side and edges HKGraph g3(v3a, v3b); // execute the algorithm g3.addEdge(0,1); diff --git a/hashing/double_hash_hash_table.cpp b/hashing/double_hash_hash_table.cpp index f5d803ba22f..31228095190 100644 --- a/hashing/double_hash_hash_table.cpp +++ b/hashing/double_hash_hash_table.cpp @@ -248,7 +248,7 @@ using double_hashing::totalSize; * @returns 0 on success */ int main() { - int cmd = 0, hash = 0, key = 0; + int cmd = 0, key = 0; std::cout << "Enter the initial size of Hash Table. = "; std::cin >> totalSize; table = std::vector(totalSize); diff --git a/hashing/linear_probing_hash_table.cpp b/hashing/linear_probing_hash_table.cpp index d87cb9cf727..fa6d40b470d 100644 --- a/hashing/linear_probing_hash_table.cpp +++ b/hashing/linear_probing_hash_table.cpp @@ -222,7 +222,7 @@ using linear_probing::totalSize; * @returns 0 on success */ int main() { - int cmd = 0, hash = 0, key = 0; + int cmd = 0, key = 0; std::cout << "Enter the initial size of Hash Table. = "; std::cin >> totalSize; table = std::vector(totalSize); diff --git a/hashing/quadratic_probing_hash_table.cpp b/hashing/quadratic_probing_hash_table.cpp index 258c009d0f7..d7e5389e5a0 100644 --- a/hashing/quadratic_probing_hash_table.cpp +++ b/hashing/quadratic_probing_hash_table.cpp @@ -244,7 +244,7 @@ using quadratic_probing::totalSize; * @returns None */ int main() { - int cmd = 0, hash = 0, key = 0; + int cmd = 0, key = 0; std::cout << "Enter the initial size of Hash Table. = "; std::cin >> totalSize; table = std::vector(totalSize); diff --git a/machine_learning/kohonen_som_trace.cpp b/machine_learning/kohonen_som_trace.cpp index 63a0c02c65f..224591269b8 100644 --- a/machine_learning/kohonen_som_trace.cpp +++ b/machine_learning/kohonen_som_trace.cpp @@ -103,7 +103,7 @@ namespace machine_learning { void update_weights(const std::valarray &x, std::vector> *W, std::valarray *D, double alpha, int R) { - int j = 0, k = 0; + int j = 0; int num_out = W->size(); // number of SOM output nodes // int num_features = x.size(); // number of data features diff --git a/machine_learning/ordinary_least_squares_regressor.cpp b/machine_learning/ordinary_least_squares_regressor.cpp index 0c865761bee..64b2c16fcba 100644 --- a/machine_learning/ordinary_least_squares_regressor.cpp +++ b/machine_learning/ordinary_least_squares_regressor.cpp @@ -367,8 +367,6 @@ std::vector predict_OLS_regressor(std::vector> const &X, /** Self test checks */ void ols_test() { - int F = 3, N = 5; - /* test function = x^2 -5 */ std::cout << "Test 1 (quadratic function)...."; // create training data set with features = x, x^2, x^3 diff --git a/numerical_methods/successive_approximation.cpp b/numerical_methods/successive_approximation.cpp index 351382f2418..76ae51364d6 100644 --- a/numerical_methods/successive_approximation.cpp +++ b/numerical_methods/successive_approximation.cpp @@ -18,7 +18,7 @@ static float eqd(float y) { return 0.5 * (cos(y) + 2); } /** Main function */ int main() { - float y, x1, x2, x3, sum, s, a, f1, f2, gd; + float y, x1, x2, sum; int i, n; for (i = 0; i < 10; i++) { diff --git a/others/matrix_exponentiation.cpp b/others/matrix_exponentiation.cpp index bde7f521bbc..1f21c4f900a 100644 --- a/others/matrix_exponentiation.cpp +++ b/others/matrix_exponentiation.cpp @@ -128,7 +128,7 @@ int main() { cout.tie(0); ll t; cin >> t; - ll i, j, x; + ll i, x; while (t--) { cin >> mat_size; for (i = 0; i < mat_size; i++) { diff --git a/range_queries/mo.cpp b/range_queries/mo.cpp index 10abf0a96c3..adc10255482 100644 --- a/range_queries/mo.cpp +++ b/range_queries/mo.cpp @@ -29,7 +29,7 @@ bool mycmp(query x, query y) { } int main() { - int n, t, i, j, k = 0; + int n, t, i; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); bucket_size = ceil(sqrt(n));