Skip to content

style: remove unused variables #2946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ciphers/hill_cipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ class HillCipher {
int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt;

matrix<double> tmp_inverse = get_inverse(encrypt_key);
double d2 = determinant_lu(decrypt_key);

// find co-prime factor for inversion
int det_inv = -1;
Expand Down
2 changes: 1 addition & 1 deletion data_structures/rb_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion dynamic_programming/maximum_circular_subarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> arr = {8, -8, 9, -9, 10, -11, 12};
assert(dynamic_programming::maxCircularSum(arr) == 22); // this ensures that the algorithm works as expected

Expand Down
6 changes: 3 additions & 3 deletions graph/hopcroft_karp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion hashing/double_hash_hash_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entry>(totalSize);
Expand Down
2 changes: 1 addition & 1 deletion hashing/linear_probing_hash_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entry>(totalSize);
Expand Down
2 changes: 1 addition & 1 deletion hashing/quadratic_probing_hash_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entry>(totalSize);
Expand Down
2 changes: 1 addition & 1 deletion machine_learning/kohonen_som_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace machine_learning {
void update_weights(const std::valarray<double> &x,
std::vector<std::valarray<double>> *W,
std::valarray<double> *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

Expand Down
2 changes: 0 additions & 2 deletions machine_learning/ordinary_least_squares_regressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ std::vector<float> predict_OLS_regressor(std::vector<std::vector<T>> 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
Expand Down
2 changes: 1 addition & 1 deletion numerical_methods/successive_approximation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion others/matrix_exponentiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion range_queries/mo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Loading