mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-03 02:25:57 +08:00
style: remove unused variables (#2946)
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
};
|
||||
void RBtree::insert()
|
||||
{
|
||||
int z, i = 0;
|
||||
int z;
|
||||
cout << "\nEnter key of the node to be inserted: ";
|
||||
cin >> z;
|
||||
node *p, *q;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user