From 40e1b5f0383b6829d3d9b7e90f3c4fa90bb6e106 Mon Sep 17 00:00:00 2001 From: "J.R. Strayhorn" Date: Thu, 25 Oct 2018 10:05:31 -0400 Subject: [PATCH 001/333] syncing fork --- Sorting/Counting Sort/C/counting_sort.c | 80 +++++++++++-------------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/Sorting/Counting Sort/C/counting_sort.c b/Sorting/Counting Sort/C/counting_sort.c index 0c58f73f7..ba9972488 100644 --- a/Sorting/Counting Sort/C/counting_sort.c +++ b/Sorting/Counting Sort/C/counting_sort.c @@ -1,48 +1,38 @@ -#include -#include -#define RANGE 255 - -// The main function that sort the given string arr[] in -// alphabatical order -void countSort(char arr[]) -{ - // The output character array that will have sorted arr - char output[strlen(arr)]; - - // Create a count array to store count of inidividul - // characters and initialize count array as 0 - int count[RANGE + 1], i; - memset(count, 0, sizeof(count)); - - // Store count of each character - for(i = 0; arr[i]; ++i) - ++count[arr[i]]; - - // Change count[i] so that count[i] now contains actual - // position of this character in output array - for (i = 1; i <= RANGE; ++i) - count[i] += count[i-1]; - - // Build the output character array - for (i = 0; arr[i]; ++i) - { - output[count[arr[i]]-1] = arr[i]; - --count[arr[i]]; +#include +#include +#include +void countingSort(int* arr, int highest, int num){ + int* Count = (int*)malloc(highest*sizeof(int)); + int* Sorted = (int*)malloc(num*sizeof(int)); + for(int i=0;ik) + k = arr[i]; + } + countingSort(arr,k,n); + return 0; } From 8fbfce680df9dbbde3813530d9fbbede56452576 Mon Sep 17 00:00:00 2001 From: "J.R. Strayhorn" Date: Thu, 25 Oct 2018 10:19:45 -0400 Subject: [PATCH 002/333] Add longest string fcc csharp --- .../c-sharp/find-longest-string-test.cs | 37 +++++++++++++++++++ .../c-sharp/find-longest-string.cs | 18 +++++++++ .../Find-Longest-String-FCC/readme.md | 14 +++++++ 3 files changed, 69 insertions(+) create mode 100644 Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string-test.cs create mode 100644 Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string.cs create mode 100644 Other Algorithms/Find-Longest-String-FCC/readme.md diff --git a/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string-test.cs b/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string-test.cs new file mode 100644 index 000000000..0613c80be --- /dev/null +++ b/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string-test.cs @@ -0,0 +1,37 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AlgorithmService; + +namespace AlgorithmService.Tests +{ + [TestClass] + public class BasicAlgorithmServiceTests + { + private readonly BasicAlgorithmService _basicAlgorithmService; + + public BasicAlgorithmServiceTests() + { + _basicAlgorithmService = new BasicAlgorithmService(); + } + + [TestMethod] + public void FindLongestWordLength_ReturnCorrectType() + { + var result = _basicAlgorithmService.FindLongestWordLength("The quick brown fox jumped over the lazy dog"); + + Assert.IsInstanceOfType(result, typeof(int)); + } + + [DataTestMethod] + [DataRow("The quick brown fox jumped over the lazy dog", 6)] + [DataRow("May the force be with you", 5)] + [DataRow("Google do a barrel roll", 6)] + [DataRow("What is the average airspeed velocity of an unladen swallow", 8)] + [DataRow("What if we try a super-long word such as otorhinolaryngology", 19)] + public void FindLongestWordLength_ReturnCorrectValue(string input, int expected) + { + var result = _basicAlgorithmService.FindLongestWordLength(input); + + Assert.AreEqual(expected, result); + } + } +} \ No newline at end of file diff --git a/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string.cs b/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string.cs new file mode 100644 index 000000000..063ebe1b2 --- /dev/null +++ b/Other Algorithms/Find-Longest-String-FCC/c-sharp/find-longest-string.cs @@ -0,0 +1,18 @@ +using System.Linq; + +namespace AlgorithmService +{ + public class BasicAlgorithmService + { + public int FindLongestWordLength(string input) + { + if (string.IsNullOrWhiteSpace(input)) + throw new InvalidOperationException("Your input cannot be blank."); + + return input + .Split(' ') + .Select(w => w.Length) + .Max(); + } + } +} \ No newline at end of file diff --git a/Other Algorithms/Find-Longest-String-FCC/readme.md b/Other Algorithms/Find-Longest-String-FCC/readme.md new file mode 100644 index 000000000..0e13ee3df --- /dev/null +++ b/Other Algorithms/Find-Longest-String-FCC/readme.md @@ -0,0 +1,14 @@ +Find the Longest Word in a String + (taken from FreeCodeCamp - Basic Algorithms) + +Instructions +- Return the length of the longest word in the provided sentence. +- Your response should be a number. + +Test Scenarios +- findLongestWordLength("The quick brown fox jumped over the lazy dog") should return a number. +- findLongestWordLength("The quick brown fox jumped over the lazy dog") should return 6. +- findLongestWordLength("May the force be with you") should return 5. +- findLongestWordLength("Google do a barrel roll") should return 6. +- findLongestWordLength("What is the average airspeed velocity of an unladen swallow") should return 8. +- findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") should return 19. \ No newline at end of file From 8c9a2514caa057c584d296d3fe982eacb6da7814 Mon Sep 17 00:00:00 2001 From: Bhanu Teja Kodali <43725371+bhanutejabt@users.noreply.github.com> Date: Thu, 25 Oct 2018 07:35:54 -0700 Subject: [PATCH 003/333] Create README.md added Branch and bound description --- Branch And Bound/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Branch And Bound/README.md diff --git a/Branch And Bound/README.md b/Branch And Bound/README.md new file mode 100644 index 000000000..51cf0a2b2 --- /dev/null +++ b/Branch And Bound/README.md @@ -0,0 +1,20 @@ +# BRANCH AND BOUND + + +- **Branch and bound (BB, B&B, or BnB)** is an algorithm design paradigm for discrete and combinatorial optimization problems, as well as mathematical optimization. +A branch-and-bound algorithm consists of a systematic enumeration of candidate solutions by means of **state space search:** the set of candidate solutions is +thought of as forming a rooted tree with the full set at the root. + +- The algorithm explores branches of this tree, which represent subsets of the solution set. Before enumerating the candidate solutions of a branch, +the branch is checked against upper and lower estimated bounds on the optimal solution, and is discarded if it cannot produce a better solution than the best one found so far by the algorithm. + +- The term branch-and-bound refers to all state space search methods in which all children of the £-node are generated before any other live node can + become the £-node. +- We have already seen two graph search strategies, BFS and D-search, in which the exploration of a new node cannot begin until the node currently + being explored is fully explored. +- Both of these generalize to branch-and-bound strategies. + - In branch-and-bound terminology, a BFS-like state space search will be called FIFO (First In First Out) + search as the list of live nodes is a first-in-first-out list (or queue). + + - A D-search-like state space search will be called LIFO (Last In First Out) + search as the list of live nodes is a last-in-first-out list (or stack From ca0fc563441a6f6eddd2252e5fdf77f4e5f88643 Mon Sep 17 00:00:00 2001 From: Bhanu Teja Kodali <43725371+bhanutejabt@users.noreply.github.com> Date: Thu, 25 Oct 2018 07:38:18 -0700 Subject: [PATCH 004/333] Create 0_1Knapsack.cpp Added knapsack branch and bound in cpp --- .../0_1 Knapsack/CPP/0_1Knapsack.cpp | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp diff --git a/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp b/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp new file mode 100644 index 000000000..51feddf92 --- /dev/null +++ b/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp @@ -0,0 +1,100 @@ +#include +using namespace std; + +struct Item +{ + float weight; + int value; +}; + +struct Node +{ + int level, profit, bound; + float weight; +}; + +bool cmp(Item a, Item b) +{ + double r1 = (double)a.value / a.weight; + double r2 = (double)b.value / b.weight; + return r1 > r2; +} + +int bound(Node u, int n, int W, Item arr[]) +{ + if (u.weight >= W) + return 0; + + int profit_bound = u.profit; + + int j = u.level + 1; + int totweight = u.weight; + + while ((j < n) && (totweight + arr[j].weight <= W)) + { + totweight += arr[j].weight; + profit_bound += arr[j].value; + j++; + } + if (j < n) + profit_bound += (W - totweight) * arr[j].value / + arr[j].weight; + + return profit_bound; +} + +int knapsack(int W, Item arr[], int n) +{ + sort(arr, arr + n, cmp); + + queue Q; + Node u, v; + + u.level = -1; + u.profit = u.weight = 0; + Q.push(u); + + int maxProfit = 0; + while (!Q.empty()) + { + u = Q.front(); + Q.pop(); + if (u.level == -1) + v.level = 0; + if (u.level == n-1) + continue; + v.level = u.level + 1; + + v.weight = u.weight + arr[v.level].weight; + v.profit = u.profit + arr[v.level].value; + + if (v.weight <= W && v.profit > maxProfit) + maxProfit = v.profit; + + v.bound = bound(v, n, W, arr); + + if (v.bound > maxProfit) + Q.push(v); + + v.weight = u.weight; + v.profit = u.profit; + v.bound = bound(v, n, W, arr); + if (v.bound > maxProfit) + Q.push(v); + } + + return maxProfit; +} + +int main() +{ + int W = 10; + Item arr[] = {{2, 40}, {3.14, 50}, {1.98, 100}, + {5, 95}, {3, 30}}; + int n = sizeof(arr) / sizeof(arr[0]); + + cout << "Maximum possible profit = " + << knapsack(W, arr, n); + + return 0; +} From f4784585e81064a4d08fcb890e66e4ebaaab40e4 Mon Sep 17 00:00:00 2001 From: Bhanu Teja Kodali <43725371+bhanutejabt@users.noreply.github.com> Date: Thu, 25 Oct 2018 07:40:19 -0700 Subject: [PATCH 005/333] Create README.md --- Branch And Bound/0_1 Knapsack/README.md | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Branch And Bound/0_1 Knapsack/README.md diff --git a/Branch And Bound/0_1 Knapsack/README.md b/Branch And Bound/0_1 Knapsack/README.md new file mode 100644 index 000000000..99ccb10ce --- /dev/null +++ b/Branch And Bound/0_1 Knapsack/README.md @@ -0,0 +1,26 @@ +# 0/1 Knapsack Problem (using BRANCH & BOUND) + +## Problem: + +1. Given two integer arrays val[0..n-1] and wt[0..n-1] that represent values and weights associated with n items respectively. +2. Find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to Knapsack capacity W. +3. We have ‘n’ items with value v1 , v2 . . . vn and weight of the corresponding items is w1 , w2 . . . Wn . Max capacity is W . +4. We can either choose or not choose an item. We have x1 , x2 . . . xn. Here xi = { 1 , 0 }. xi = 1 , item chosen xi = 0 , item not chosen. + +## Why Branch And Bound? +- Greedy approach works only for fractional knapsack problem. +- If weights are not integers , dynamic programming will not work. +- There are 2n possible combinations of item , complexity for brute force goes exponentially. + +## Algorithm: +1. Sort all items in decreasing order of ratio of value per unit weight so that an upper bound can be computed using Greedy Approach. +2. Initialize maximum profit, maxProfit = 0 +3. Create an empty queue, Q. +4. Create a dummy node of decision tree and enqueue it to Q. + Profit and weight of dummy node are 0. +5. Do following while Q is not empty. + - Extract an item from Q. Let the extracted item be u. + - Compute profit of next level node. If the profit is more than maxProfit, then update maxProfit. + - Compute bound of next level node. If bound is more than maxProfit, then add next level node to Q. + - Consider the case when next level node is not considered as part of solution and add a node to queue with level as next, + but weight and profit without considering next level nodes. From 8472d50e933cab0dc17a3ca621e00e4ac8aa9ca7 Mon Sep 17 00:00:00 2001 From: Bhanu Teja Kodali <43725371+bhanutejabt@users.noreply.github.com> Date: Thu, 25 Oct 2018 07:41:51 -0700 Subject: [PATCH 006/333] added 0_1 Knapsack Branch and Bound in cpp --- Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp b/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp index 51feddf92..23ff6adea 100644 --- a/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp +++ b/Branch And Bound/0_1 Knapsack/CPP/0_1Knapsack.cpp @@ -96,5 +96,5 @@ int main() cout << "Maximum possible profit = " << knapsack(W, arr, n); - return 0; + return 0; } From c67f37f94db363b0a0ec067dd32381b4055adf01 Mon Sep 17 00:00:00 2001 From: corxew Date: Thu, 25 Oct 2018 21:21:25 +0530 Subject: [PATCH 007/333] Added Brian Kernighan algorithm to count the number of set bits --- Bit Manipulation/Brian_Kernighan_Algorithm.c | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Bit Manipulation/Brian_Kernighan_Algorithm.c diff --git a/Bit Manipulation/Brian_Kernighan_Algorithm.c b/Bit Manipulation/Brian_Kernighan_Algorithm.c new file mode 100644 index 000000000..1135d6458 --- /dev/null +++ b/Bit Manipulation/Brian_Kernighan_Algorithm.c @@ -0,0 +1,24 @@ + +#include + +/* Count set bits */ +unsigned int countSetBits(int num) +{ + unsigned int count = 0; + while (num) + { + num &= (n-1) ; + count++; + } + return count; +} + +/* Program to test function countSetBits */ +int main() +{ + /* count set bits in 9 */ + int numnum = 9; + printf("%d", countSetBits(numnum)); + getchar(); + return 0; +} \ No newline at end of file From b143e0b3d6560719a24af90e729706128781ba4f Mon Sep 17 00:00:00 2001 From: Ayush Songra <30820868+Corxrew@users.noreply.github.com> Date: Thu, 25 Oct 2018 21:25:05 +0530 Subject: [PATCH 008/333] Update Brian_Kernighan_Algorithm.c --- Bit Manipulation/Brian_Kernighan_Algorithm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bit Manipulation/Brian_Kernighan_Algorithm.c b/Bit Manipulation/Brian_Kernighan_Algorithm.c index 1135d6458..c7840aae5 100644 --- a/Bit Manipulation/Brian_Kernighan_Algorithm.c +++ b/Bit Manipulation/Brian_Kernighan_Algorithm.c @@ -7,7 +7,7 @@ unsigned int countSetBits(int num) unsigned int count = 0; while (num) { - num &= (n-1) ; + num &= (num-1) ; count++; } return count; @@ -21,4 +21,4 @@ int main() printf("%d", countSetBits(numnum)); getchar(); return 0; -} \ No newline at end of file +} From c6e5e2497607179364e457d8698f831ded00020e Mon Sep 17 00:00:00 2001 From: Mateus Alves Tranquilino Date: Thu, 25 Oct 2018 13:37:47 -0300 Subject: [PATCH 009/333] Add files via upload Flavious Josephus Algorithm --- Recursive Algorithms/josephus.cpp | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Recursive Algorithms/josephus.cpp diff --git a/Recursive Algorithms/josephus.cpp b/Recursive Algorithms/josephus.cpp new file mode 100644 index 000000000..ad15ead71 --- /dev/null +++ b/Recursive Algorithms/josephus.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + +/** + * Algoritmo recursivo de Flavious Josephus + * @author: Mateus Tranquilino + * */ + +/** + * Calcula o sobrevivente no problema de Flavious Josephus + * em um circulo de N pessoas e de salto K. + * */ +int josephus(int n, int k){ + if(n==1) return 1; + return ( ( ( josephus(n-1, k) + k-1) % n ) + 1); +} + +int main(){ + unsigned int n, k; + int x; + printf("Quantos casos de Testes? "); + scanf("%d", &x); + + for (int i=0; i < x; i++){ + printf("O número de pessoas no circulo "); + scanf("%d", &n); + printf("O tamanho do salto "); + scanf("%d", &k); + printf("No caso %d a pessoa na posição %d termina viva\n", i+1, josephus(n,k)); + cout << endl; + } +} From 2c1febe8abed6c695c214b1288a47de1d4d98b12 Mon Sep 17 00:00:00 2001 From: Ronistone Junior Date: Thu, 25 Oct 2018 13:49:59 -0300 Subject: [PATCH 010/333] Adding #include --- Graphs/Traveling Salesman Problem/tsp.cpp | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Graphs/Traveling Salesman Problem/tsp.cpp diff --git a/Graphs/Traveling Salesman Problem/tsp.cpp b/Graphs/Traveling Salesman Problem/tsp.cpp new file mode 100644 index 000000000..cef99f509 --- /dev/null +++ b/Graphs/Traveling Salesman Problem/tsp.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; + +double V[16][16]; +vector > P; +int n; + +double dp[20][1 << 16]; + +inline double calc(int i,int j){ + return sqrt((P[i].first-P[j].first)*(P[i].first-P[j].first) + (P[i].second - P[j].second)*(P[i].second - P[j].second)); +} + +double solve(int current, int mask){ + if(mask == ((1<<(n+1))-1)){ + return V[current][0]; + } + + if(dp[current][mask]!=-1) return dp[current][mask]; + + double ans = 1e9 + 10; + + for(int i=1;i<=n;i++){ + if(!(mask & (1<> n and n){ + P.clear(); + for(int i=0;i<=n;i++){ + for(int j=0;j<=(1<<(n+1));j++){ + dp[i][j] = -1; + } + } + cin >> x >> y; + P.push_back(make_pair(x,y)); + for(int i=1;i<=n;i++){ + cin >> a >> b; + P.push_back(make_pair(a,b)); + } + for(int i=0;i<=n;i++){ + for(int j=0;j<=n;j++){ + V[i][j] = calc(i,j); + } + } + cout << fixed << setprecision(2) << solve(0,1) << endl; + } +} + From b219dd6fc5a2f92e473f01808d8c3566beb48ce1 Mon Sep 17 00:00:00 2001 From: FrNecas Date: Thu, 25 Oct 2018 19:12:39 +0200 Subject: [PATCH 011/333] Add algorithm for generating magic squares Signed-off-by: FrNecas --- .../Magic Squares/Python/magic_squares.py | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Backtracking/Magic Squares/Python/magic_squares.py diff --git a/Backtracking/Magic Squares/Python/magic_squares.py b/Backtracking/Magic Squares/Python/magic_squares.py new file mode 100644 index 000000000..bb8056a94 --- /dev/null +++ b/Backtracking/Magic Squares/Python/magic_squares.py @@ -0,0 +1,87 @@ +""" +Magic square is a square filled with numbers starting with one +in a way that the sum of each row, column and diagonal is the same. + +The following algorithm uses a recursive approach, it could +be implemented iteratively but the algorithm would be way longer. + +""" + + +import time + +start = time.time() + + +def expected_row_sum(square_size): + """Calculates the expected row sum based on square size.""" + return int(sum(range(1, square_size ** 2 + 1)) / square_size) + + +def get_column(square_size, square, i): + """Returns an i-th column of a square.""" + expected_modulo = i % square_size + col = [] + for i, item in enumerate(square): + if i % square_size == expected_modulo: + col.append(item) + return col + + +def magic_squares(square_size, square=None, used=None, i=0): + if square is None: + square = [None for _ in range(square_size ** 2)] + if used is None: + used = [False for _ in range(square_size ** 2)] + row_sum = expected_row_sum(square_size) + if i == square_size ** 2: + # left to right diagonal, for size 3, the indexes are 0, 4, 8 (increments by 4 to get the next field so that + # is square_size + 1) + d1_sum = 0 + for j in range(square_size): + d1_sum += square[j * (square_size + 1)] + # right to left diagonal, for size 3, the indexes are 2, 4, 6 (increments by 2 to get the next field so that + # is square_size - 1. Also starts at 2 not 0. + d2_sum = 0 + for j in range(square_size): + d2_sum += square[(j + 1) * (square_size - 1)] + + if d1_sum == row_sum and d2_sum == row_sum: + cp = list(square) + yield [[cp.pop(0) for _ in range(square_size)] for __ in range(square_size)] + else: + # try to insert all possible numbers - backtracking + for n in range(1, square_size ** 2 + 1): + square[i] = n + if not used[n - 1]: + # check row sum after each row + if (i + 1) % square_size == 0: + if sum(square[i - square_size + 1: i + 1]) != row_sum: + continue + # if we are on the last line, check column + if i >= square_size * (square_size - 1): + if sum(get_column(square_size, square, i)) != row_sum: + continue + used[n - 1] = True + + else: + continue + + # yield from gets the result from the lowest recursion level, works only in py 3.3+, slower alternative: + # for s in magic_squares(square_size, square, used, i + 1): + # yield s + yield from magic_squares(square_size, square, used, i + 1) + # reset to the previous state + used[n - 1] = False + + +number_of_solutions = 0 +for sq in magic_squares(3): + number_of_solutions += 1 + for line in sq: + print(' '.join([str(x) for x in line])) + print('\n') + +print(number_of_solutions) + +print('--- %s seconds ---' % (time.time() - start)) From 5a277c2a09af6a34ae9135d5f4f3e0be9bebe035 Mon Sep 17 00:00:00 2001 From: Przemek Bajkowski Date: Thu, 25 Oct 2018 20:38:18 +0200 Subject: [PATCH 012/333] Update Mathematics/fibonacci/php/fibbonacci.php --- Mathematics/fibonacci/php/fibbonacci.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Mathematics/fibonacci/php/fibbonacci.php diff --git a/Mathematics/fibonacci/php/fibbonacci.php b/Mathematics/fibonacci/php/fibbonacci.php new file mode 100644 index 000000000..2ef77ca1f --- /dev/null +++ b/Mathematics/fibonacci/php/fibbonacci.php @@ -0,0 +1,16 @@ + \ No newline at end of file From 4e9223df8c97b86e8c6ce9cb2f28c601759749d4 Mon Sep 17 00:00:00 2001 From: Nilesh Laxmi Date: Fri, 26 Oct 2018 00:10:38 +0530 Subject: [PATCH 013/333] Updated Armstrong Number in Javascript and added README file for Mathematical problems descriptions --- .../Armstrong_no/javascript/armstrong.js | 23 +++++++++++++++++++ Mathematics/README.md | 9 ++++++++ 2 files changed, 32 insertions(+) create mode 100644 Mathematics/Armstrong_no/javascript/armstrong.js create mode 100644 Mathematics/README.md diff --git a/Mathematics/Armstrong_no/javascript/armstrong.js b/Mathematics/Armstrong_no/javascript/armstrong.js new file mode 100644 index 000000000..a5d281a95 --- /dev/null +++ b/Mathematics/Armstrong_no/javascript/armstrong.js @@ -0,0 +1,23 @@ +/** + * An Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits. + * For instance, a 3 digit number will be considered an Armstrong number if the sum of the cubes of its digits is equal to the number itself. + * For example, 153 is an Armstrong number, as 1**3 + 5**3 + 3**3 = 153 + */ + +const armstrongNumber = (num) => { + let sum = 0; + let ar = num.toString().split(""); + for(let i = 0; i Date: Thu, 25 Oct 2018 15:44:29 -0300 Subject: [PATCH 014/333] Another version of Kruskal --- graph/kruskal/cpp/KruskalOtherVersion.cpp | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 graph/kruskal/cpp/KruskalOtherVersion.cpp diff --git a/graph/kruskal/cpp/KruskalOtherVersion.cpp b/graph/kruskal/cpp/KruskalOtherVersion.cpp new file mode 100644 index 000000000..933b27cf9 --- /dev/null +++ b/graph/kruskal/cpp/KruskalOtherVersion.cpp @@ -0,0 +1,64 @@ +#include +#define SIZE 124770 +using namespace std; + +typedef long long ll; + +ll parents[SIZE]; +pair > ladj[SIZE]; // adjacency matrix + +int search(ll x){ + if (parents[x] == x){ + return x; + } + + return parents[x] = search(parents[x]); +} + +void join(ll x, ll y){ + x = search(x); + y = search(y); + + if (x == y){ + return; + } + parents[x] = y; + return; +} + +ll kruskal(ll m, pair> ladj[]){ + ll x, y; + ll cost; + ll min_cost = 0; + + for (ll i = 1; i <= m; i++){ + x = ladj[i].second.first; + y = ladj[i].second.second; + cost = ladj[i].first; + if (search(x) != search(y)){ + printf("%lld -> %lld : COST = %lld\n", x, y, cost); + min_cost += cost; + join(x, y); + } + } + return min_cost; +} + +int main(){ + ll n, m, u, v, c; + // n = number of vertices m = number of edges u, v = vertices c = edge weight + scanf("%lld %lld", &n, &m); + + for (ll i = 0; i <= n; i++){ + parents[i] = i; + } + + for (ll i = 1; i <= m; i++){ + scanf("%lld %lld %lld", &u, &v, &c); + ladj[i] = make_pair(c, make_pair(u, v)); + } + + sort(ladj + 1, ladj + m + 1); + printf("The result is: %lld\n", kruskal(m, ladj)); + return 0; +} \ No newline at end of file From 9d7da201925b6dc531a0a49b88c20b184df67c81 Mon Sep 17 00:00:00 2001 From: Nilesh Laxmi Date: Fri, 26 Oct 2018 00:20:52 +0530 Subject: [PATCH 015/333] Added reverse Number in Javascript --- Mathematics/reverse number/reverseNumber.js | 17 +++++ Sorting/Counting Sort/C/counting_sort.c | 80 +++++++++------------ 2 files changed, 52 insertions(+), 45 deletions(-) create mode 100644 Mathematics/reverse number/reverseNumber.js diff --git a/Mathematics/reverse number/reverseNumber.js b/Mathematics/reverse number/reverseNumber.js new file mode 100644 index 000000000..3cd4e09f0 --- /dev/null +++ b/Mathematics/reverse number/reverseNumber.js @@ -0,0 +1,17 @@ +function revInt(num) { + var rem, rev=0; + while(num > 0){ + rem = num % 10; + rev = rev*10 + rem; + num = parseInt(num/10); + } + console.log(rev); +} + +// Commented Out ShortCut method +// const revInt = (n) => { +// let rev = n.toString().split('').reverse().join(""); +// console.log(Number(rev)); +// } + +revInt(15); \ No newline at end of file diff --git a/Sorting/Counting Sort/C/counting_sort.c b/Sorting/Counting Sort/C/counting_sort.c index 0c58f73f7..ba9972488 100644 --- a/Sorting/Counting Sort/C/counting_sort.c +++ b/Sorting/Counting Sort/C/counting_sort.c @@ -1,48 +1,38 @@ -#include -#include -#define RANGE 255 - -// The main function that sort the given string arr[] in -// alphabatical order -void countSort(char arr[]) -{ - // The output character array that will have sorted arr - char output[strlen(arr)]; - - // Create a count array to store count of inidividul - // characters and initialize count array as 0 - int count[RANGE + 1], i; - memset(count, 0, sizeof(count)); - - // Store count of each character - for(i = 0; arr[i]; ++i) - ++count[arr[i]]; - - // Change count[i] so that count[i] now contains actual - // position of this character in output array - for (i = 1; i <= RANGE; ++i) - count[i] += count[i-1]; - - // Build the output character array - for (i = 0; arr[i]; ++i) - { - output[count[arr[i]]-1] = arr[i]; - --count[arr[i]]; +#include +#include +#include +void countingSort(int* arr, int highest, int num){ + int* Count = (int*)malloc(highest*sizeof(int)); + int* Sorted = (int*)malloc(num*sizeof(int)); + for(int i=0;ik) + k = arr[i]; + } + countingSort(arr,k,n); + return 0; } From 176219db25405be9937b30abb17f21d82841d273 Mon Sep 17 00:00:00 2001 From: Hisham Mubarak Date: Fri, 26 Oct 2018 00:21:53 +0530 Subject: [PATCH 016/333] Update Coding Practice Sites section in readme,md Added FreeCodeCamp to Coding Practice Sites --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9480e6185..94a031855 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ Clean example implementations of data structures and algorithms written in diffe * [CodeWars](https://codewars.com/) * [Coderbyte](https://www.coderbyte.com/) * [HireVue](https://www.hirevue.com/) + * [FreeCodeCamp](https://www.freecodecamp.org/) + # Project Maintainers * [Vishal Gaur](https://github.com/i-vishi):tada:
* [Ravi Varshney](https://github.com/ravivarshney01):tada:
From 7adb808ab850d3e7b351e22f7fcba1d5a0ad1d5d Mon Sep 17 00:00:00 2001 From: inama19 <44481369+inama19@users.noreply.github.com> Date: Thu, 25 Oct 2018 21:49:45 +0100 Subject: [PATCH 017/333] simple list --- data structures/linked list/c/list.c | 224 +++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 data structures/linked list/c/list.c diff --git a/data structures/linked list/c/list.c b/data structures/linked list/c/list.c new file mode 100644 index 000000000..83b565d9d --- /dev/null +++ b/data structures/linked list/c/list.c @@ -0,0 +1,224 @@ +#include +#include +#include "list.h" + +/** +* Retourne une nouvelle Liste +* @return Une liste vide +*/ +List new_list(void) +{ + return NULL; +} + +/*---------------------------------------------------------------------*/ + +/** +* Vérifie si une List est vide +* @param li La liste à tester +* @return true si elle est vide, faux sinon +*/ +Bool is_empty_list(List li) +{ + if(li == NULL) + return true; + + return false; +} + +/*---------------------------------------------------------------------*/ + +/** +* Affiche une Liste +* @param li La liste à afficher +*/ +void print_list(List li) +{ + if(is_empty_list(li)) + { + printf("Rien a afficher, la Liste est vide.\n"); + return; + } + + while(li != NULL) + { + printf("[%d] ", li->value); + li = li->next; + } + + printf("\n"); +} + +/*---------------------------------------------------------------------*/ + +/** +* Retourne la taille de la Liste +* @param li La liste +* @return Le nombre d'élements de la Liste +*/ +int list_length(List li) +{ + int size = 0; + + if(is_empty_list(li)) + return size; + + while(li != NULL) + { + size++; + li = li->next; + } + + return size; +} + +/*---------------------------------------------------------------------*/ + +/** +* Ajoute un entier en fin de Liste +* @param li La liste +* @param x L'entier à insérer +* @return La liste avec le nouvel élement ajouté +*/ +List push_back_list(List li, int x) +{ + ListElement *element; + + element = malloc(sizeof(*element)); + + if(element == NULL) + { + fprintf(stderr, "Erreur : probleme allocation dynamique.\n"); + exit(EXIT_FAILURE); + } + + element->value = x; + element->next = NULL; + + if(is_empty_list(li)) + return element; + + ListElement *temp; + temp = li; + + while(temp->next != NULL) + temp = temp->next; + + temp->next = element; + + return li; +} + +/*---------------------------------------------------------------------*/ + +/** +* Ajoute un entier en début de Liste +* @param li La liste +* @param x L'entier à insérer +* @return La liste avec le nouvel élement ajouté +*/ +List push_front_list(List li, int x) +{ + ListElement *element; + + element = malloc(sizeof(*element)); + + if(element == NULL) + { + fprintf(stderr, "Erreur : probleme allocation dynamique.\n"); + exit(EXIT_FAILURE); + } + + element->value = x; + + if(is_empty_list(li)) + element->next = NULL; + else + element->next = li; + + return element; +} + +/*---------------------------------------------------------------------*/ + +/** +* Supprime un entier de la fin de la Liste +* @param li La liste +* @return La liste sans l'élément retiré +*/ +List pop_back_list(List li) +{ + if(is_empty_list(li)) + return new_list(); + + //Si la liste n'a qu'un seul élément + if(li->next == NULL) + { + free(li); + li = NULL; + + return new_list(); + } + + ListElement *temp = li; + ListElement *before = li; + + while(temp->next != NULL) + { + before = temp; + temp = temp->next; + } + + before->next = NULL; + + free(temp); + temp = NULL; + + return li; +} + +/*---------------------------------------------------------------------*/ + +/** +* Supprime un entier de la tête de la Liste +* @param li La liste +* @return La liste sans l'élément retiré +*/ +List pop_front_list(List li) +{ + ListElement *element; + + element = malloc(sizeof(*element)); + + if(element == NULL) + { + fprintf(stderr, "Erreur : probleme allocation dynamique.\n"); + exit(EXIT_FAILURE); + } + + if(is_empty_list(li)) + return new_list(); + + element = li->next; + + free(li); + li = NULL; + + return element; +} + +/*---------------------------------------------------------------------*/ + +/** +* Supprime tous les éléments d'une Liste +* @param li La liste +* @return Une Liste vide +*/ +List clear_list(List li) +{ + if(is_empty_list(li)) + return new_list(); + + while(li != NULL) + li = pop_front_list(li); +} From 40506c1361d289621285be4b588ecfec3f836ab3 Mon Sep 17 00:00:00 2001 From: inama19 <44481369+inama19@users.noreply.github.com> Date: Thu, 25 Oct 2018 21:50:58 +0100 Subject: [PATCH 018/333] Create liste.h --- data structures/linked list/c/liste.h | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 data structures/linked list/c/liste.h diff --git a/data structures/linked list/c/liste.h b/data structures/linked list/c/liste.h new file mode 100644 index 000000000..4112b9dac --- /dev/null +++ b/data structures/linked list/c/liste.h @@ -0,0 +1,29 @@ +#ifndef __LIST__H__ +#define __LIST__H__ + + /* Définition d'un Booléen */ + typedef enum + { + false, + true + }Bool; + + /* Définition d'une Liste */ + typedef struct ListElement + { + int value; + struct ListElement *next; + }ListElement, *List; + + /* Prototypes */ + List new_list(void); + Bool is_empty_list(List li); + void print_list(List li); + int list_length(List li); + List push_back_list(List li, int x); + List push_front_list(List li, int x); + List pop_back_list(List li); + List pop_front_list(List li); + List clear_list(List li); + +#endif From fad3633e64e7e8be18c3274f2ec567865b2a8ba5 Mon Sep 17 00:00:00 2001 From: Icantknow <34726550+Icantknow@users.noreply.github.com> Date: Thu, 25 Oct 2018 17:45:28 -0400 Subject: [PATCH 019/333] Update ModularExp.py Cleaned up code for consistency --- Mathematics/modular exp/python/ModularExp.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Mathematics/modular exp/python/ModularExp.py b/Mathematics/modular exp/python/ModularExp.py index a9b7772f6..36a0d0ced 100644 --- a/Mathematics/modular exp/python/ModularExp.py +++ b/Mathematics/modular exp/python/ModularExp.py @@ -1,14 +1,18 @@ #! python 3 -def power(x, y ,p ) : + +# base, exponent, and prime (mod) +x = 2 +y = 32 +p = 1023 + +def power(x, y, p): res = 1 x = x%p - while(y>0) : - if y %2 == 1 : - res = (res*x) % p + while y>0: + if y%2 == 1: + res = (res*x)%p y = y/2 x = (x*x)%p return res - - -print( power(2,32,1023)) +print(power(x,y,p)) From a56a1888dabe2d528797208683a7747fa254eccf Mon Sep 17 00:00:00 2001 From: Icantknow <34726550+Icantknow@users.noreply.github.com> Date: Thu, 25 Oct 2018 18:41:55 -0400 Subject: [PATCH 020/333] Create ModularExp.java created java modular exponentiation --- Mathematics/modular exp/java/ModularExp.java | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Mathematics/modular exp/java/ModularExp.java diff --git a/Mathematics/modular exp/java/ModularExp.java b/Mathematics/modular exp/java/ModularExp.java new file mode 100644 index 000000000..f50431ba7 --- /dev/null +++ b/Mathematics/modular exp/java/ModularExp.java @@ -0,0 +1,25 @@ +public class ModularExp { + // computes n raised to the nonnegative power e modulo m + public static long exp(long n, int e, int m) { + if (e == 0) { + return 1L; + } + + n %= m; + long ans = 1; + + if (e%2 == 0) { + return exp(ans*ans, e/2, m); + } + else { + return n*exp(ans*ans, e/2, m); + } + } + + public static void main(String[] args) { + long n = 137; + int e = 207; + int m = 18; + System.out.println(exp(n,e,m)); + } +} From 8fb623707e534b326b11c6d5ac2a98e2a3883400 Mon Sep 17 00:00:00 2001 From: Harindu973 Date: Fri, 26 Oct 2018 06:50:13 +0530 Subject: [PATCH 021/333] I added new Binary serch algorithm --- Searching/binary search/c/BS.c | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Searching/binary search/c/BS.c diff --git a/Searching/binary search/c/BS.c b/Searching/binary search/c/BS.c new file mode 100644 index 000000000..9e76d78da --- /dev/null +++ b/Searching/binary search/c/BS.c @@ -0,0 +1,44 @@ + +// C program to implement recursive Binary Search +#include + +// A recursive binary search function. It returns +// location of x in given array arr[l..r] is present, +// otherwise -1 +int binarySearch(int arr[], int l, int r, int x) +{ + if (r >= l) + { + int mid = l + (r - l)/2; + + // If the element is present at the middle + // itself + if (arr[mid] == x) + return mid; + + // If element is smaller than mid, then + // it can only be present in left subarray + if (arr[mid] > x) + return binarySearch(arr, l, mid-1, x); + + // Else the element can only be present + // in right subarray + return binarySearch(arr, mid+1, r, x); + } + + // We reach here when element is not + // present in array + return -1; +} + +int main(void) +{ + int arr[] = {2, 3, 4, 10, 40}; + int n = sizeof(arr)/ sizeof(arr[0]); + int x = 10; + int result = binarySearch(arr, 0, n-1, x); + (result == -1)? printf("Element is not present in array") + : printf("Element is present at index %d", + result); + return 0; +} \ No newline at end of file From 14bb05d4f4d311b40580269e3cf211ef7a3b7e67 Mon Sep 17 00:00:00 2001 From: sajithaliyanage Date: Fri, 26 Oct 2018 10:18:27 +0530 Subject: [PATCH 022/333] Add graph datastructure --- data structures/Graph/Example/GraphExample.py | 91 ++++++++++ data structures/Graph/GraphAL.py | 77 +++++++++ data structures/Graph/GraphBFS.py | 70 ++++++++ data structures/Graph/GraphDFS(Letters).py | 116 +++++++++++++ data structures/Graph/GraphDFS.py | 106 ++++++++++++ data structures/Graph/GraphDictionaries.py | 157 ++++++++++++++++++ 6 files changed, 617 insertions(+) create mode 100644 data structures/Graph/Example/GraphExample.py create mode 100644 data structures/Graph/GraphAL.py create mode 100644 data structures/Graph/GraphBFS.py create mode 100644 data structures/Graph/GraphDFS(Letters).py create mode 100644 data structures/Graph/GraphDFS.py create mode 100644 data structures/Graph/GraphDictionaries.py diff --git a/data structures/Graph/Example/GraphExample.py b/data structures/Graph/Example/GraphExample.py new file mode 100644 index 000000000..bd933b0a8 --- /dev/null +++ b/data structures/Graph/Example/GraphExample.py @@ -0,0 +1,91 @@ +class Node: + def __init__(self,vertex): + self.vertex = vertex + self.next = None + def getEndNode(self): + nextNode = self + returnNode = self + while(nextNode!=None): + returnNode = nextNode + nextNode = nextNode.next + return returnNode +class Graph: + def __init__(self): + self.graphItems = [] #graph vertexes + self.graph = [] #graph with nodes + self.edges = [] + def addVertex(self,data): + self.graphItems.append(data) + self.graph.append(None) + def getVertexNumber(self,value): + return self.graphItems.index(value)+1 + def addEdge(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + fromNode = self.graph[vertexFrom-1] + node = Node(vertexTo) + if(fromNode!=None): #check whether there is a path added to the fromeNode position if not, node will be the first path + endNode = fromNode.getEndNode() + endNode.next = node + else: + self.graph[vertexFrom-1] = node + def isEdge(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + currentPos = self.graph[vertexFrom-1] + while(currentPos!=None): + if(currentPos.vertex==vertexTo): + return True + currentPos = currentPos.next + return False + def isPath(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + visited = [] + queue = [] + queue.append(vertexFrom) + while(len(queue)>0): + vertex = queue.pop(0) + if(vertex not in visited): + visited.append(vertex) + currentNode = self.graph[vertex-1] + while(currentNode!=None): + if(currentNode.vertex==vertexTo): + return True + queue.append(currentNode.vertex) + currentNode = currentNode.next + return False + def isVertex(self,vertex): + return vertex in self.graphItems + def __str__(self): + return self.printGraph("key") + def printGraph(self,gtype=None): + out = "" + for i in range(len(self.graph)): + paths = "" + node = self.graph[i] + while(node!=None): + if(gtype=="key"): + paths += "-->"+str(node.vertex) + else: + paths += "-->"+str(self.graphItems[node.vertex-1]) + node = node.next + if(gtype=="key"): + out += "V"+str(i+1)+" :"+paths+"\n" + else: + out += str(self.graphItems[i])+" :"+paths+"\n" + return out +graph = Graph() +while(True): + userInput = str(input()) + if(userInput=="END"): + break + vertexFrom = userInput.split()[0] + vertexTo = userInput.split()[1] + #Creating the vertexes if vertexes are not already created + if(not graph.isVertex(vertexFrom)): + graph.addVertex(vertexFrom) + if(not graph.isVertex(vertexTo)): + graph.addVertex(vertexTo) + graph.addEdge(vertexFrom,vertexTo) +print(graph) diff --git a/data structures/Graph/GraphAL.py b/data structures/Graph/GraphAL.py new file mode 100644 index 000000000..50788a304 --- /dev/null +++ b/data structures/Graph/GraphAL.py @@ -0,0 +1,77 @@ +class Node: + def __init__(self,vertex): + self.vertex = vertex + self.next = None + def getEndNode(self): + nextNode = self + returnNode = self + while(nextNode!=None): + returnNode = nextNode + nextNode = nextNode.next + return returnNode +class Graph: + def __init__(self): + self.graphItems = [] #graph vertexes + self.graph = [] #graph with nodes + self.edges = [] + def addVertex(self,data): + self.graphItems.append(data) + self.graph.append(None) + def getVertexNumber(self,value): + return self.graphItems.index(value)+1 + def addEdge(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + fromNode = self.graph[vertexFrom-1] + node = Node(vertexTo) + if(fromNode!=None): #check whether there is a path added to the fromeNode position if not, node will be the first path + endNode = fromNode.getEndNode() + endNode.next = node + else: + self.graph[vertexFrom-1] = node + def isEdge(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + currentPos = self.graph[vertexFrom-1] + while(currentPos!=None): + if(currentPos.vertex==vertexTo): + return True + currentPos = currentPos.next + return False + def isPath(self,vertexFrom,vertexTo): + vertexFrom = self.getVertexNumber(vertexFrom) + vertexTo = self.getVertexNumber(vertexTo) + visited = [] + queue = [] + queue.append(vertexFrom) + while(len(queue)>0): + vertex = queue.pop(0) + if(vertex not in visited): + visited.append(vertex) + currentNode = self.graph[vertex-1] + while(currentNode!=None): + if(currentNode.vertex==vertexTo): + return True + queue.append(currentNode.vertex) + currentNode = currentNode.next + return False + def isVertex(self,vertex): + return vertex in self.graphItems + def __str__(self): + return self.printGraph("key") + def printGraph(self,gtype=None): + out = "" + for i in range(len(self.graph)): + paths = "" + node = self.graph[i] + while(node!=None): + if(gtype=="key"): + paths += "-->"+str(node.vertex) + else: + paths += "-->"+str(self.graphItems[node.vertex-1]) + node = node.next + if(gtype=="key"): + out += "V"+str(i+1)+" :"+paths+"\n" + else: + out += str(self.graphItems[i])+" :"+paths+"\n" + return out diff --git a/data structures/Graph/GraphBFS.py b/data structures/Graph/GraphBFS.py new file mode 100644 index 000000000..165192067 --- /dev/null +++ b/data structures/Graph/GraphBFS.py @@ -0,0 +1,70 @@ +class Node: + def __init__(self,vertex): + self.vertex = vertex + self.next = None + +userinput = str(input("Number of nodes and edges : ")).split() #First line as a string and split (from spaces) it to an array. +N = int(userinput[0]) #Extract Number of vertexes +M = int(userinput[1]) #Extract Number of edges + +graph = [] #Create an array to hold the graph +for i in range(N): + graph.append(None) + +#Requesting next M lines of inputs which are the description of edges +for i in range(M): + edges = str(input("Edge if between vertexes : ")).split() #string input line of the user splitted in to an array + fromVertex = int(edges[0]) #extracting the 1st vertex of the user input and assigning it to fromVertex + toVertex = int(edges[1])#extracting the 2nd vertex of the user input and assigning it to toVertex + + #Now let us create a node to toVertex and put that it to a/the linkedlist in the postion of fromVertex in the main graph + node = Node(toVertex) #creating the node + #if there's no linkedlist already in that position, then put the node there + if(graph[fromVertex-1]== None): + graph[fromVertex-1] = node + else: + #if there's already a linkedlist append the linkedlist to the newly created node and put that in to the position of fromNode in the main graph + node.next = graph[fromVertex-1] + graph[fromVertex-1] = node + +def bfs(graph,source): + color = [] + distance = [] + for i in range(len(graph)): + color.append("white") + distance.append(None) + color[source-1] = "gray" + distance[source-1] = 0 + Queue = [] + Queue.append(source) + while(len(Queue)!=0): + u = Queue.pop(0) + node = graph[u-1] + while(node!=None): + if(color[node.vertex-1]=="white"): + Queue.append(node.vertex) + color[node.vertex-1]="gray" + distance[node.vertex-1] = distance[u-1]+1 + node = node.next + color[u-1] = "black" + return distance + +#Now let us see how we can use this BFS +#If you want to print distances from 3 to other vertexes, call bfs function with the source vertex 3. +print(bfs(graph,3)) + + + + + + + + + + + + + + + + diff --git a/data structures/Graph/GraphDFS(Letters).py b/data structures/Graph/GraphDFS(Letters).py new file mode 100644 index 000000000..58552e81e --- /dev/null +++ b/data structures/Graph/GraphDFS(Letters).py @@ -0,0 +1,116 @@ +class Node: + def __init__(self,vertex): + self.vertex = vertex + self.next = None + def __repr__(self): + out = "" + tn = self + while(tn!=None): + out += str(tn.vertex)+"->" + tn = tn.next + return out[0:len(out)-2] +class Stack: + def __init__(self): + self.stack = [] + def push(self,data): + self.stack.append(data) + def pop(self): + return self.stack.pop() + def peek(self): + return self.stack[len(self.stack)-1] + def isEmpty(self): + return len(self.stack)==0 + +vertexdata = [] +#all the vertex UIs should go through this function +def getVertex(vertexData): + global vertexdata + #returns the position of graph + + return vertexdata.index(vertexData)#int(vertexData)-1 +def getVertexData(vertex): + global vertexdata + return vertexdata[vertex] +def makeData(amount): + global vertexdata + vertexdata = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")[0:amount] +userinput = str(input()).split() +N = int(userinput[0]) +M = int(userinput[1]) + +graph = [] +makeData(N) +for i in range(N): + graph.append(None) + +for i in range(M): + edges = str(input()).split() + fromVertex = edges[0] #fromVertex is UI + toVertex = edges[1] #toVertex is UI + node = Node(getVertex(toVertex)) + if(graph[getVertex(fromVertex)]== None): + graph[getVertex(fromVertex)] = node + else: + node.next = graph[getVertex(fromVertex)] + graph[getVertex(fromVertex)] = node + #since undirected + node = Node(getVertex(fromVertex)) + if(graph[getVertex(toVertex)]== None): + graph[getVertex(toVertex)] = node + else: + node.next = graph[getVertex(toVertex)] + graph[getVertex(toVertex)] = node + +def dfs(graph,start): #source is UI + global vertexdata + order = [] + time = 0 #time count + dTime = [] #discover times + fTime = [] #final times + predecessor = [] + + visited = Stack() + + colors = ["White" for i in range(len(graph))] + dTime = [None for i in range(len(graph))] + fTime = [None for i in range(len(graph))] + predecessor = [None for i in range(len(graph))] + + sources = list(range(len(graph))) + start = sources.pop(getVertex(start)) + sources = [start]+sources + for source in sources: + if(colors[source]=="White"): + time+=1 + colors[source] = "Gray" + dTime[source] = time + visited.push(source) + while(not visited.isEmpty()): + current = visited.peek() + adjecents = [] + adjList = graph[current] + tempNode = adjList + while(tempNode!=None): + adjecents.append(tempNode.vertex) + tempNode = tempNode.next + adjecents.sort() + currentVertex = None + for i in range(len(adjecents)): + if(colors[adjecents[i]]=="White"): + time +=1 + currentVertex = adjecents[i] + colors[adjecents[i]]="Gray" + dTime[adjecents[i]]=time + predecessor[adjecents[i]] = current + break + if(currentVertex==None): + time +=1 + vertex = visited.pop() + colors[vertex]="Black" + dTime[vertex]=time + order.append(vertexdata[vertex]) + else: + visited.push(currentVertex) + return order + +print(dfs(graph,"A")) diff --git a/data structures/Graph/GraphDFS.py b/data structures/Graph/GraphDFS.py new file mode 100644 index 000000000..d6f39d1d7 --- /dev/null +++ b/data structures/Graph/GraphDFS.py @@ -0,0 +1,106 @@ +class Node: + def __init__(self,vertex): + self.vertex = vertex + self.next = None + def __repr__(self): + out = "" + tn = self + while(tn!=None): + out += str(tn.vertex)+"->" + tn = tn.next + return out[0:len(out)-2] +class Stack: + def __init__(self): + self.stack = [] + def push(self,data): + self.stack.append(data) + def pop(self): + return self.stack.pop() + def peek(self): + return self.stack[len(self.stack)-1] + def isEmpty(self): + return len(self.stack)==0 + +#all the vertex UIs should go through this function +def getVertex(vertexData): + return int(vertexData)-1 + +userinput = str(input()).split() +N = int(userinput[0]) +M = int(userinput[1]) + +graph = [] +for i in range(N): + graph.append(None) + +for i in range(M): + edges = str(input()).split() + fromVertex = edges[0] #fromVertex is UI + toVertex = edges[1] #toVertex is UI + node = Node(getVertex(toVertex)) + if(graph[getVertex(fromVertex)]== None): + graph[getVertex(fromVertex)] = node + else: + node.next = graph[getVertex(fromVertex)] + graph[getVertex(fromVertex)] = node + #since undirected + node = Node(getVertex(fromVertex)) + if(graph[getVertex(toVertex)]== None): + graph[getVertex(toVertex)] = node + else: + node.next = graph[getVertex(toVertex)] + graph[getVertex(toVertex)] = node + +def dfs(graph,start): #source is UI + global vertexdata + order = [] + time = 0 #time count + dTime = [] #discover times + fTime = [] #final times + predecessor = [] + + visited = Stack() + + colors = ["White" for i in range(len(graph))] + dTime = [None for i in range(len(graph))] + fTime = [None for i in range(len(graph))] + predecessor = [None for i in range(len(graph))] + + sources = list(range(len(graph))) + start = sources.pop(getVertex(start)) + sources = [start]+sources + for source in sources: + if(colors[source]=="White"): + time+=1 + colors[source] = "Gray" + dTime[source] = time + visited.push(source) + while(not visited.isEmpty()): + current = visited.peek() + adjecents = [] + adjList = graph[current] + tempNode = adjList + while(tempNode!=None): + adjecents.append(tempNode.vertex) + tempNode = tempNode.next + adjecents.sort() + currentVertex = None + for i in range(len(adjecents)): + if(colors[adjecents[i]]=="White"): + time +=1 + currentVertex = adjecents[i] + colors[adjecents[i]]="Gray" + dTime[adjecents[i]]=time + predecessor[adjecents[i]] = current + break + if(currentVertex==None): + time +=1 + vertex = visited.pop() + colors[vertex]="Black" + dTime[vertex]=time + order.append(vertexdata[vertex]) + else: + visited.push(currentVertex) + return order + +print(dfs(graph,"A")) diff --git a/data structures/Graph/GraphDictionaries.py b/data structures/Graph/GraphDictionaries.py new file mode 100644 index 000000000..a97140517 --- /dev/null +++ b/data structures/Graph/GraphDictionaries.py @@ -0,0 +1,157 @@ +class Graph(object): + def __init__(self,graph={}): + self.graph=graph + + def vertices(self): + return list(self.graph.keys()) + + def isVertex(self,vertex): + vert=self.vertices() + if vertex in vert: + return True + else: + return False + + + def edges(self): + return self.generateEdges() + + def isEdge(self,vertexFrom,vertexTo): + edgesOfGraph=self.edges() + if (vertexFrom,vertexTo) in edgesOfGraph: + return True + else: + return False + + def addVertex(self,vertex): + if vertex not in self.graph: + self.graph[vertex]=[] + + def addEdge(self,edge): + edge=set(edge) + (vertex1,vertex2)=tuple(edge) + if vertex1 in self.graph: + self.graph[vertex1].append(vertex2) + else: + self.graph[vertex1]=[vertex2] + + def generateEdges(self): + edges=[] + for vertex in self.graph: + for neighbour in self.graph[vertex]: + if (neighbour,vertex) not in edges: + edges.append((vertex,neighbour)) + return edges + + def printGraph(self): + res="Vertices : " + for k in self.graph: + res+=str(k)+" " + res+="\nedges :" + for edge in self.generateEdges(): + res+=str(edge)+" " + return res + + def findPath(self,startVertex,endVertex,path=[]): + graph=self.graph + path=path+[startVertex] + if startVertex==endVertex: + return path + if startVertex not in graph: + return None + for vertex in graph[startVertex]: + if vertex not in path: + extendedPath=self.findPath(vertex,endVertex,path) + + if extendedPath: + return extendedPath + return None + + def find_all_paths(self, startVertex, endVertex, path=[]): + + graph = self.graph + path = path + [startVertex] + if startVertex == endVertex: + return [path] + if startVertex not in graph: + return [] + paths = [] + for vertex in graph[startVertex]: + if vertex not in path: + extendedPaths = self.find_all_paths(vertex, + endVertex, + path) + for p in extendedPaths: + paths.append(p) + return paths + + def findOutDegree(self,vertex): + vert=self.vertices() + if vertex not in vert: + return None + else: + count=0 + for vrtx in self.graph: + if vrtx==vertex: + for neighbour in self.graph[vertex]: + count+=1 + return count + + def findInDegree(self,vertex): + vert=self.vertices() + if vertex not in vert: + return None + else: + count=0 + for vrtx in self.graph: + for neighbour in self.graph[vrtx]: + if neighbour==vertex: + count+=1 + return count + + + +g = { "a" : ["c"], + "b" : ["e"], + "c" : ["b", "d", "e","f"], + "d" : [], + "e" : ["f","c"], + "f" : ["b"] + } +gW = { "a":[1], + "b":[2], + "c":[] + } + +graph = Graph(g) +''' +graph.vertices() +['a', 'c', 'b', 'e', 'd', 'f'] + +graph.isEdge('b','c') +False + +graph.isEdge('c','b') +True + +graph.findPath('a','c') +['a', 'c'] + +graph.findPath('a','f') +['a', 'c', 'b', 'e', 'f'] + +graph.find_all_paths('a','f') +[['a', 'c', 'b', 'e', 'f'], ['a', 'c', 'e', 'f'], ['a', 'c', 'f']] + +graph.findInDegree('c') +2 + +graph.findOutDegree('c') +4 + +graph.findInDegree('f') +2 + +graph.findOutDegree('f') +1 + ''' From 87c27563c26eefdcc84e92f365039c885d66b9bf Mon Sep 17 00:00:00 2001 From: Vatsal Parsaniya <33985480+Vatsalparsaniya@users.noreply.github.com> Date: Fri, 26 Oct 2018 11:03:37 +0530 Subject: [PATCH 023/333] Created Binary_Search_Tree in c++ --- .../Binary Search Tree/Binary_Search_Tree.cpp | 373 ++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 Tree/Binary Search Tree/Binary_Search_Tree.cpp diff --git a/Tree/Binary Search Tree/Binary_Search_Tree.cpp b/Tree/Binary Search Tree/Binary_Search_Tree.cpp new file mode 100644 index 000000000..b79d7e07f --- /dev/null +++ b/Tree/Binary Search Tree/Binary_Search_Tree.cpp @@ -0,0 +1,373 @@ +/* + * C++ Program To Implement BST + */ +# include +# include +using namespace std; +/* + * Node Declaration + */ +struct node +{ + int info; + struct node *left; + struct node *right; +}*root; + +/* + * Class Declaration + */ +class BST +{ + public: + void find(int, node **, node **); + void insert(int); + void del(int); + void case_a(node *,node *); + void case_b(node *,node *); + void case_c(node *,node *); + void preorder(node *); + void inorder(node *); + void postorder(node *); + void display(node *, int); + BST() + { + root = NULL; + } +}; +/* + * Main Contains Menu + */ +int main() +{ + int choice, num; + BST bst; + node *temp; + while (1) + { + cout<<"-----------------"<>choice; + switch(choice) + { + case 1: + temp = new node; + cout<<"Enter the number to be inserted : "; + cin>>temp->info; + bst.insert(root, temp); + case 2: + if (root == NULL) + { + cout<<"Tree is empty, nothing to delete"<>num; + bst.del(num); + break; + case 3: + cout<<"Inorder Traversal of BST:"<info) + { + *loc = root; + *par = NULL; + return; + } + if (item < root->info) + ptr = root->left; + else + ptr = root->right; + ptrsave = root; + while (ptr != NULL) + { + if (item == ptr->info) + { + *loc = ptr; + *par = ptrsave; + return; + } + ptrsave = ptr; + if (item < ptr->info) + ptr = ptr->left; + else + ptr = ptr->right; + } + *loc = NULL; + *par = ptrsave; +} + +/* + * Inserting Element into the Tree + */ +void BST::insert(node *tree, node *newnode) +{ + if (root == NULL) + { + root = new node; + root->info = newnode->info; + root->left = NULL; + root->right = NULL; + cout<<"Root Node is Added"<info == newnode->info) + { + cout<<"Element already in the tree"<info > newnode->info) + { + if (tree->left != NULL) + { + insert(tree->left, newnode); + } + else + { + tree->left = newnode; + (tree->left)->left = NULL; + (tree->left)->right = NULL; + cout<<"Node Added To Left"<right != NULL) + { + insert(tree->right, newnode); + } + else + { + tree->right = newnode; + (tree->right)->left = NULL; + (tree->right)->right = NULL; + cout<<"Node Added To Right"<left == NULL && location->right == NULL) + case_a(parent, location); + if (location->left != NULL && location->right == NULL) + case_b(parent, location); + if (location->left == NULL && location->right != NULL) + case_b(parent, location); + if (location->left != NULL && location->right != NULL) + case_c(parent, location); + free(location); +} + +/* + * Case A + */ +void BST::case_a(node *par, node *loc ) +{ + if (par == NULL) + { + root = NULL; + } + else + { + if (loc == par->left) + par->left = NULL; + else + par->right = NULL; + } +} + +/* + * Case B + */ +void BST::case_b(node *par, node *loc) +{ + node *child; + if (loc->left != NULL) + child = loc->left; + else + child = loc->right; + if (par == NULL) + { + root = child; + } + else + { + if (loc == par->left) + par->left = child; + else + par->right = child; + } +} + +/* + * Case C + */ +void BST::case_c(node *par, node *loc) +{ + node *ptr, *ptrsave, *suc, *parsuc; + ptrsave = loc; + ptr = loc->right; + while (ptr->left != NULL) + { + ptrsave = ptr; + ptr = ptr->left; + } + suc = ptr; + parsuc = ptrsave; + if (suc->left == NULL && suc->right == NULL) + case_a(parsuc, suc); + else + case_b(parsuc, suc); + if (par == NULL) + { + root = suc; + } + else + { + if (loc == par->left) + par->left = suc; + else + par->right = suc; + } + suc->left = loc->left; + suc->right = loc->right; +} + +/* + * Pre Order Traversal + */ +void BST::preorder(node *ptr) +{ + if (root == NULL) + { + cout<<"Tree is empty"<info<<" "; + preorder(ptr->left); + preorder(ptr->right); + } +} +/* + * In Order Traversal + */ +void BST::inorder(node *ptr) +{ + if (root == NULL) + { + cout<<"Tree is empty"<left); + cout<info<<" "; + inorder(ptr->right); + } +} + +/* + * Postorder Traversal + */ +void BST::postorder(node *ptr) +{ + if (root == NULL) + { + cout<<"Tree is empty"<left); + postorder(ptr->right); + cout<info<<" "; + } +} + +/* + * Display Tree Structure + */ +void BST::display(node *ptr, int level) +{ + int i; + if (ptr != NULL) + { + display(ptr->right, level+1); + cout<: "; + else + { + for (i = 0;i < level;i++) + cout<<" "; + } + cout<info; + display(ptr->left, level+1); + } +} From 01d2f23a3560688883b15bf173421eb6ca19e413 Mon Sep 17 00:00:00 2001 From: arham_aalam Date: Fri, 26 Oct 2018 11:14:27 +0530 Subject: [PATCH 024/333] adding Logistic regression algorithm scala script in Apache Spark --- logistic-regression/README.md | 3 + logistic-regression/logistic-reg-scala.txt | 144 +++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 logistic-regression/README.md create mode 100644 logistic-regression/logistic-reg-scala.txt diff --git a/logistic-regression/README.md b/logistic-regression/README.md new file mode 100644 index 000000000..8768f6c4c --- /dev/null +++ b/logistic-regression/README.md @@ -0,0 +1,3 @@ +Logistic regression + +In statistics, the logistic model (or logit model) is a widely used statistical model that, in its basic form, uses a logistic function to model a binary dependent variable; many more complex extensions exist. In regression analysis, logistic regression (or logit regression) is estimating the parameters of a logistic model; it is a form of binomial regression. Mathematically, a binary logistic model has a dependent variable with two possible values, such as pass/fail, win/lose, alive/dead or healthy/sick; these are represented by an indicator variable, where the two values are labeled "0" and "1". In the logistic model, the log-odds (the logarithm of the odds) for the value labeled "1" is a linear combination of one or more independent variables ("predictors"); the independent variables can each be a binary variable (two classes, coded by an indicator variable) or a continuous variable (any real value). The corresponding probability of the value labeled "1" can vary between 0 (certainly the value "0") and 1 (certainly the value "1"), hence the labeling; the function that converts log-odds to probability is the logistic function, hence the name. The unit of measurement for the log-odds scale is called a logit, from logistic unit, hence the alternative names. Analogous models with a different sigmoid function instead of the logistic function can also be used, such as the probit model; the defining characteristic of the logistic model is that increasing one of the independent variables multiplicatively scales the odds of the given outcome at a constant rate, with each dependent variable having its own parameter; for a binary independent variable this generalizes the odds ratio. diff --git a/logistic-regression/logistic-reg-scala.txt b/logistic-regression/logistic-reg-scala.txt new file mode 100644 index 000000000..4809a2da1 --- /dev/null +++ b/logistic-regression/logistic-reg-scala.txt @@ -0,0 +1,144 @@ + +// I took reference from here: https://towardsdatascience.com/building-a-logistic-regression-in-python-step-by-step-becd4d56c9c8 +//The dataset comes from the UCI Machine Learning repository, and it is related to direct marketing campaigns (phone calls) of a Portuguese +//banking institution. The classification goal is to predict whether the client will subscribe (1/0) to a term deposit (variable y). The dataset +//can be downloaded from here: https://raw.githubusercontent.com/madmashup/targeted-marketing-predictive-engine/master/banking.csv + +> import org.apache.log4j. + +> Logger.getLogger("org").setLevel(Level.ERROR) + +//reading data from csv +> val data = spark.read.format("csv").option("header", "true").option("inferschema", "true").load("/home/arham/Documents/spark-pro/banking.csv") + +//getting only the usefull columns for our model +//why we use these columns? find it here https://towardsdatascience.com/building-a-logistic-regression-in-python-step-by-step-becd4d56c9c8#a448 +> val needed_cols = (data.select(data("y").as("label"), $"job",$"marital",$"education",$"default",$"housing",$"loan",$"contact",$"month",$"day_of_week",$"poutcome")) + +//getting number of records +> needed_cols.count() +//res17: Long = 41188 + +> needed_cols.show(20) + +//drop all null rows +> val reduced_null_value_data = needed_cols.na.drop() + +//percentage of class 0 or not taking subscription +scala> (reduced_null_value_data.where("label == 0").count()*100)/reduced_null_value_data.count() +//res43: Long = 88 + +//percentage of class 1 or taking subscription +> (reduced_null_value_data.where("label == 1").count()*100)/reduced_null_value_data.count() +//res44: Long = 11 + +> import org.apache.spark.ml.feature.{OneHotEncoder, StringIndexer} + +// indexing the column values find more about it here: https://spark.apache.org/docs/latest/ml-features.html#stringindexer +> val job_indexer = new StringIndexer().setInputCol("job").setOutputCol("job_index").fit(reduced_null_value_data) + +> val edu_indexer = new StringIndexer().setInputCol("education").setOutputCol("education_index").fit(reduced_null_value_data) + +> val marital_indexer = new StringIndexer().setInputCol("marital").setOutputCol("marital_index").fit(reduced_null_value_data) + +> val def_indexer = new StringIndexer().setInputCol("default").setOutputCol("default_index").fit(reduced_null_value_data) + +> val housing_indexer = new StringIndexer().setInputCol("housing").setOutputCol("housing_index").fit(reduced_null_value_data) + +> val loan_indexer = new StringIndexer().setInputCol("loan").setOutputCol("loan_index").fit(reduced_null_value_data) + +> val contact_indexer = new StringIndexer().setInputCol("contact").setOutputCol("contact_index").fit(reduced_null_value_data) + +> val month_indexer = new StringIndexer().setInputCol("month").setOutputCol("month_index").fit(reduced_null_value_data) + +> val day_of_week_indexer = new StringIndexer().setInputCol("day_of_week").setOutputCol("day_of_week_index").fit(reduced_null_value_data) + +> val poutcome_indexer = new StringIndexer().setInputCol("poutcome").setOutputCol("poutcome_index").fit(reduced_null_value_data) + + +// Encoding the column values find more about it here: https://spark.apache.org/docs/2.1.0/ml-features.html#onehotencoder +> val edu_vector = new OneHotEncoder().setInputCol("education_index").setOutputCol("education_vector") + +> val marital_vector = new OneHotEncoder().setInputCol("marital_index").setOutputCol("marital_vector") + +> val job_vector = new OneHotEncoder().setInputCol("job_index").setOutputCol("job_vector") + +> val def_vector = new OneHotEncoder().setInputCol("default_index").setOutputCol("default_vector") + +> val housing_vector = new OneHotEncoder().setInputCol("housing_index").setOutputCol("housing_vector") + +> val loan_vector = new OneHotEncoder().setInputCol("loan_index").setOutputCol("loan_vector") + +> val contact_vector = new OneHotEncoder().setInputCol("contact_index").setOutputCol("contact_vector") + +> val month_vector = new OneHotEncoder().setInputCol("month_index").setOutputCol("month_vector") + +> val day_of_week_vector = new OneHotEncoder().setInputCol("day_of_week_index").setOutputCol("day_of_week_vector") + +> val poutcome_vector = new OneHotEncoder().setInputCol("poutcome_index").setOutputCol("poutcome_vector") + +> import org.apache.spark.ml.feature.{VectorAssembler, VectorIndexer} + +// combining all feature columns find more here: https://spark.apache.org/docs/2.1.0/ml-features.html#vectorassembler +> val assembler = newVectorAssembler().setInputCols(Array("job_vector","marital_vector","education_vector","default_vector","housing_vector","loan_vector","contact_vector","month_vector","day_of_week_vector","poutcome_vector")).setOutputCol("features") + +//splitting data with ratio 70:30 - training:testing +> val Array(training, testing) = reduced_null_value_data.randomSplit(Array(0.7, 0.3), seed=10) + +> import org.apache.spark.ml.Pipeline + +> import org.apache.spark.ml.classification.LogisticRegression + +> val log_reg = new LogisticRegression() + +//executing all through a pipeline +> val pipeline = new Pipeline().setStages(Array(job_indexer, marital_indexer, edu_indexer, def_indexer, housing_indexer, loan_indexer, contact_indexer, month_indexer, day_of_week_indexer, poutcome_indexer, job_vector, marital_vector, edu_vector, def_vector, housing_vector, loan_vector, contact_vector, month_vector, day_of_week_vector, poutcome_vector, assembler, log_reg)) + +//training +> val model = pipeline.fit(training) + +//testing +> val result = model.transform(testing) + +////////////////// +//Model Evaluation + +> result.printSchema + +> import org.apache.spark.mllib.evaluation.MulticlassMetrics + +// getting prediction and label from result and converting to rdd for Evaluation (because MulticlassMetrics need rdd and only available in mllib +//find more here: https://spark.apache.org/docs/2.3.0/mllib-evaluation-metrics.html#multiclass-classification) +> val predAndLabel = result.select($"prediction", $"label").as[(Double, Double)].rdd + +> val matrics = new MulticlassMetrics(predAndLabel) + +// getting accuracy +> matrics.accuracy +res11: Double = 0.8967916189229006 + +//getting confusion matrix +//it truly predicted 10712 records for label 0/not taking subscription +//and truly predicted 245 records for label 1/taking subscription +//131 wrong predictions for label 0/not taking subscription +//1130 wrong predictions for label 1/taking subscription +> println(matrics.confusionMatrix) +// predicted 0 predicted 1 +//actualy 0: 10712.0 131.0 +//actualy 1: 1130.0 245.0 + +//percentage of class 0 or not taking subscription(training dataset) +> (training.where("label == 0").count()*100)/training.count() +//res47: Long = 88 + +//percentage of class 1 or taking subscription (training dataset) +> (training.where("label == 1").count()*100)/training.count() +//res48: Long = 11 + +//percentage of class 0 or not taking subscription (testing dataset) +> (testing.where("label == 0").count()*100)/testing.count() +//res38: Long = 88 + +//percentage of class 1 or taking subscription (testing dataset) +> (testing.where("label == 1").count()*100)/testing.count() +//res39: Long = 11 From 605da0bbd11f67c06c223a110689f2067414274e Mon Sep 17 00:00:00 2001 From: Ricky Tham Date: Thu, 25 Oct 2018 23:07:52 -0700 Subject: [PATCH 025/333] Adding cpp version of Matrix data structure A cpp version of Matrix into the data structure column --- data structures/Matrix/cpp/Array.h | 58 ++++++++++++++++ data structures/Matrix/cpp/Matrix.h | 52 ++++++++++++++ data structures/Matrix/cpp/main.cpp | 104 ++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 data structures/Matrix/cpp/Array.h create mode 100644 data structures/Matrix/cpp/Matrix.h create mode 100644 data structures/Matrix/cpp/main.cpp diff --git a/data structures/Matrix/cpp/Array.h b/data structures/Matrix/cpp/Array.h new file mode 100644 index 000000000..e94c75b3a --- /dev/null +++ b/data structures/Matrix/cpp/Array.h @@ -0,0 +1,58 @@ +#include +#include +#include +using namespace std; + +class IndexOutOfBoundsException{}; + +template + < typename Type > +class Array +{ +private: + int len; + Type * buf; +public: + Array(int newLen) + :len( newLen ), buf( new Type [newLen] ) + { + } + Array( const Array & l) + : len( l.len ), buf( new Type [l.len] ) + { + for( int i = 0; i < l.len; i++ ) + buf[i] = l.buf[i]; // note = is incorrect if buf elements are pointers + } + int length() + { + return len; + } + Type &operator [] (int i) + throw (IndexOutOfBoundsException) + { + if (!(0 <= i && i < len)) + throw IndexOutOfBoundsException(); + return buf[i]; + } + void print(ostream & out) + { + for(int i = 0; i < len; ++i) + out << setw(8) << setprecision(2) << fixed << right << buf[i]; // #include + } + ~Array() + { + delete [] buf; + } + friend ostream & operator << ( ostream & out, Array & a ) + { + a.print( out ); + return out; + } + friend ostream & operator << (ostream & out, Array * ap) + { + ap -> print( out ); + return out; + } + // note the overloading of operator << on a pointer as wel +}; + diff --git a/data structures/Matrix/cpp/Matrix.h b/data structures/Matrix/cpp/Matrix.h new file mode 100644 index 000000000..c4aa958a7 --- /dev/null +++ b/data structures/Matrix/cpp/Matrix.h @@ -0,0 +1,52 @@ +#include "Array.h" +using namespace std; + + +template + < typename Element > +class Matrix +{ +private: + int rows, cols; + Array < Array < Element > * > m; + // define m as an Array of Array pointers using the + // template you defined above +public: + Matrix( int newRows, int newCols ) + : rows(newRows), cols (newCols), m(rows) + { + for (int i = 0; i < rows; i++) + m[i] = new Array < Element > (cols); + } + int numRows() + { + return rows; + } + int numCols() + { + return cols; + } + Array < Element > & operator [] (int row) + { + + return * m[row]; + } + void print( ostream & out) + { + for(int i = 0; i < rows; ++i) + out << m[i] << endl; + // write this one too, but use Array::operator << + } + friend ostream & operator << (ostream & out, Matrix & m) + { + m.print( out ); + return out; + } + ~Matrix() + { + for(int i = 0; i < rows; i++) + { + delete m[i]; + } + } +}; diff --git a/data structures/Matrix/cpp/main.cpp b/data structures/Matrix/cpp/main.cpp new file mode 100644 index 000000000..a028a49b5 --- /dev/null +++ b/data structures/Matrix/cpp/main.cpp @@ -0,0 +1,104 @@ +#include "Matrix.h" +#include + +template + + +void fillMatrix(Matrix &m) +{ + int i, j; + for(i=0;i < m.numRows(); i++) + m[i][0] = T(); + for(j = 0; j < m.numCols(); j++) + m[0][j] = T(); + for(i = 1; i < m.numRows(); i++) + for( j = 1; j < m.numCols(); j++) + { + m[i][j] = T(i * j); + } +} + +void test_int_matrix() +{ + cout << "Testing INT Matrix...\n" << endl; + Matrix m(10,5); + fillMatrix(m); + cout << m << "Done\n" << endl; +} + +void test_double_matrix() +{ + cout << "Testing DOUBLE Matrix...\n" << endl; + Matrix < double > M(8, 10); + fillMatrix(M); + cout << M << "Done\n" << endl; +} + +template + +void generate_exception(Matrix &m) +{ + //insert a for loop that cause the exception + cout << "Generating Exception..." << endl; + cout << "It will try to access rows 0-15 and cols 0-15\n"; + for(int i = 0; i < 15; i++) + { + for (int j = 0; j < 15; j++) + { + m[i][j]; + } + cout << endl; + } +} + +void test_double_matrix_exceptions() +{ + //PUT YOUR TRY/CATCH AROUND THE INSTRUCTIONS BELOW + try + { + cout << "Starting Double Matrix Exception...\n"; + cout << "Matrix M(8,10);\n\n"; + Matrix < double > M (8,10); + fillMatrix( M ); + cout << M; + generate_exception( M ); + } + catch ( const IndexOutOfBoundsException & e) + { + cout << "\nERROR: Index out of bounds." << endl; + } + cout << "Done\n" << endl; +} + +void test_int_matrix_exceptions() +{ + //PUT YOUR TRY/CATCH AROUND THE INSTRUCTIONS BELOW + try + { + cout << "Starting Int Matrix Exception...\n"; + cout <<"Matrix m(10,10);\n\n"; + Matrix < int > m (10,10); + fillMatrix( m ); + cout << m; + generate_exception( m ); + } + catch ( const IndexOutOfBoundsException & e) + { + cout << "\nERROR: Index out of bounds." << endl; + } + cout << "Done\n" << endl; +} + +int main() +{ + for (int i = 1; i <= 3; ++i) + { + cout << "Test " << i << "\n" << endl; + test_int_matrix(); + test_double_matrix(); + test_int_matrix_exceptions(); + test_double_matrix_exceptions(); + + } + return 0; +} From cb4e17d282dd3636d1690d559c6c673b7d8fcf92 Mon Sep 17 00:00:00 2001 From: "M. Olcay TERCANLI" Date: Fri, 26 Oct 2018 09:40:10 +0300 Subject: [PATCH 026/333] Create QuickSort.scala --- Sorting/quickSort/scala/QuickSort.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sorting/quickSort/scala/QuickSort.scala diff --git a/Sorting/quickSort/scala/QuickSort.scala b/Sorting/quickSort/scala/QuickSort.scala new file mode 100644 index 000000000..aad76d079 --- /dev/null +++ b/Sorting/quickSort/scala/QuickSort.scala @@ -0,0 +1,16 @@ +object QuickSort extends App { + def sort(list: List[Int]): List[Int] = { + list match { + case Nil => Nil + case oneElementList :: Nil => List(oneElementList) + case pivot :: tail => { + val (less, greater) = tail.partition(_ < pivot) + sort(less) ::: pivot :: sort(greater) + } + } + } + val originalList = List(10, 7, 8, 9, 1, 5) + val sortedList = sort(originalList) + println(s"originalList: ${originalList}") + println(s"sortedList: ${sortedList}") +} From 3d1e7da467a85ea1d750178f8a90b85e19250b2c Mon Sep 17 00:00:00 2001 From: Nirav116 <44491097+Nirav116@users.noreply.github.com> Date: Fri, 26 Oct 2018 12:55:39 +0530 Subject: [PATCH 027/333] Create HeavyLightDecompotion.cpp --- Other Algorithms/HeavyLightDecompotion.cpp | 305 +++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 Other Algorithms/HeavyLightDecompotion.cpp diff --git a/Other Algorithms/HeavyLightDecompotion.cpp b/Other Algorithms/HeavyLightDecompotion.cpp new file mode 100644 index 000000000..1700bf3ea --- /dev/null +++ b/Other Algorithms/HeavyLightDecompotion.cpp @@ -0,0 +1,305 @@ +#include + +using namespace std; +#define ll long long int +#define N 200002 +vector v[N]; +vector ans[N]; +vector an[N]; +int P[N][19]; +int pos[N][2]; +ll a[N]; +ll b[N]; +bool vis[N]; +int L[N]={0}; +int par[N]={0}; +int sub[N]; +vector chain[N]; +int cn=0; + +int n,m,x,y; +void dfs(int u,int p) +{ + L[u]=L[p]+1; + vis[u]=1; + par[u]=p; + for(int i=0;i= 0; i--) + if (L[p] - (1 << i) >= L[q]) + p = P[p][i]; + + if (p == q) + return p; + + for (i = log; i >= 0; i--) + if (P[p][i] != -1 && P[p][i] != P[q][i]) + p = P[p][i], q = P[q][i]; + + return par[p]; + } + + + +int main() +{ + cin>>n; + memset(vis,false,sizeof vis); + memset(vis,false,sizeof vis); + + for(int i=1;i<=n;i++)cin>>a[i]; + + for(int i=1;i<=n;i++)cin>>b[i]; + + for(int i=1;i>x>>y; + // cout<>m; + int w; + + while(m--) + { + cin>>c>>x>>y; + int z=lca(x,y); + if(c==1) + { + + while(pos[x][0]!=pos[z][0]) + { + + + t=chain[pos[x][0]][0]; + j=pos[t][0]; + k=pos[t][1]; + + ans[j][k]+=1; + j=pos[x][0]; + k=pos[x][1]+1; + ans[j][k]-=1; + x=par[t]; + + } + if(x!=z) + { + w=chain[pos[z][0]][pos[z][1]+1]; + j=pos[w][0]; + k=pos[w][1]; + ans[j][k]+=1; + j=pos[x][0]; + k=pos[x][1]+1; + ans[j][k]-=1; + + + } + while(pos[y][0]!=pos[z][0]) + { + t=chain[pos[y][0]][0]; + j=pos[t][0]; + k=pos[t][1]; + ans[j][k]+=1; + j=pos[y][0]; + k=pos[y][1]+1; + ans[j][k]-=1; + + y=par[t]; + + + } + if(y!=z) + { + + w=chain[pos[z][0]][pos[z][1]+1]; + + j=pos[w][0]; + k=pos[w][1]; + ans[j][k]+=1*1ll; + j=pos[y][0]; + k=pos[y][1]+1; + ans[j][k]-=1; + + + + } + ans[pos[z][0]][pos[z][1]]+=1; + ans[pos[z][0]][pos[z][1]+1]-=1; + + + } + else + { + + while(pos[x][0]!=pos[z][0]) + { + + t=chain[pos[x][0]][0]; + j=pos[t][0]; + k=pos[t][1]; + + an[j][k]+=1; + j=pos[x][0]; + k=pos[x][1]+1; + an[j][k]-=1; + x=par[t]; + + } + if(x!=z) + { + w=chain[pos[z][0]][pos[z][1]+1]; + + j=pos[w][0]; + k=pos[w][1]; + an[j][k]++; + j=pos[x][0]; + k=pos[x][1]+1; + an[j][k]--; + + } + while(pos[y][0]!=pos[z][0]) + { + t=chain[pos[y][0]][0]; + j=pos[t][0]; + k=pos[t][1]; + + an[j][k]++; + j=pos[y][0]; + k=pos[y][1]+1; + an[j][k]--; + y=par[t]; + + } + if(y!=z) + { + w=chain[pos[z][0]][pos[z][1]+1]; + j=pos[w][0]; + k=pos[w][1]; + an[j][k]++; + j=pos[y][0]; + k=pos[y][1]+1; + an[j][k]--; + } + an[pos[z][0]][pos[z][1]]++; + an[pos[z][0]][pos[z][1]+1]--; + + + } + } + for(i=0;i<=cn;i++) + { + for( j=0;j=1) + { + ans[i][j]+=ans[i][j-1]; + an[i][j]+=an[i][j-1]; + } + } + } + for(i=0;i<=cn;i++) + { + for(j=0;j Date: Fri, 26 Oct 2018 10:43:55 +0200 Subject: [PATCH 028/333] Generating every possible subset with bitmask. --- .../EverySubset.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Bit Manipulation/GeneratingEverySubsetWithBitmask/EverySubset.cpp diff --git a/Bit Manipulation/GeneratingEverySubsetWithBitmask/EverySubset.cpp b/Bit Manipulation/GeneratingEverySubsetWithBitmask/EverySubset.cpp new file mode 100644 index 000000000..74ec8253d --- /dev/null +++ b/Bit Manipulation/GeneratingEverySubsetWithBitmask/EverySubset.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +vectorVector; int Size; +void Solve(){ + cout << "All possible subsets are:\n"; + int Index = 1; + for (int i = 0; i < (1 << Size); i++){ + cout << Index << ") "; + for (int j = 0; j < Size; j++){ + if (i & (1 << j)){ + cout << Vector[j] << ' '; + } + } + Index++; + cout << '\n'; + } +} +int main(){ + cout << "Enter size of vector:\n"; + cin >> Size; + cout << "Enter your vector elements:\n"; + for (int i = 0; i < Size; i++){ + int Element; cin >> Element; + Vector.push_back(Element); + } + Solve(); + return 0; +} From d6dceb3304972e917ee7d37b5a64aeed62decbd2 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 26 Oct 2018 12:24:03 +0200 Subject: [PATCH 029/333] Adds java ArrayList data structure --- data structures/array/ArrayList.java | 89 ++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 data structures/array/ArrayList.java diff --git a/data structures/array/ArrayList.java b/data structures/array/ArrayList.java new file mode 100644 index 000000000..f36ff3ca8 --- /dev/null +++ b/data structures/array/ArrayList.java @@ -0,0 +1,89 @@ +public class ArrayList { + + private Object[] array; + private int size; + + public ArrayList() { + this.array = new Object[0]; + this.size = 0; + } + + public void add(Object toAdd) { + insert(toAdd, size); + } + + public void insert(Object toAdd, int position) { + if(position > size) + position = size; + Object[] array = new Object[size + 1]; + for(int i = 0, arrayIndex = 0; i < array.length; i++, arrayIndex++) { + if(i == position) { + array[arrayIndex] = toAdd; + arrayIndex++; + } + if(i < this.array.length) + array[arrayIndex] = this.array[i]; + } + this.array = array; + this.size++; + } + + /** + * @param object the object you wish to know the index of + * @return the index of the object, or -1 if the object is not in the array + */ + public int indexOf(Object object) { + for (int i = 0; i < this.size; i++) { + if(this.array[i] == object) { + return i; + } + } + return -1; + } + + /** + * @param toDelete the object to delete + * @return the object that was deleted from the arraylist, or null if the object is not in the arraylist + */ + public Object delete(T toDelete) { + int position = -1; + for (int i = 0; i < this.size; i++) { + if(this.array[i] == toDelete) { + position = i; + break; + } + } + return delete(position); + } + + /** + * @param positionToDelete the index of the object to delete + * @return the object that was deleted from the arraylist, or null if the object is not in the arraylist + */ + public Object delete(int positionToDelete) { + Object deleted = null; + if(positionToDelete > -1) { + Object[] array = new Object[size - 1]; + for (int i = 0, arrayIndex = 0; i < this.size; i++, arrayIndex++) { + if (i == positionToDelete) { + deleted = this.array[i]; + arrayIndex--; + } + else { + array[arrayIndex] = this.array[i]; + } + } + this.array = array; + size--; + } + return deleted; + } + + public Object[] getArray() { + return array; + } + + public int size() { + return size; + } +} From 19ec06af0e71bd8825efcb43f4bc0553a82a9e99 Mon Sep 17 00:00:00 2001 From: Pranjal Mishra <39010495+Pranjal1751@users.noreply.github.com> Date: Fri, 26 Oct 2018 17:07:00 +0530 Subject: [PATCH 030/333] Add files via upload --- Arduino_Code/kittybot.ino | 62 +++++++++++++++++++++++++++++++++++++++ Arduino_Code/setup.ino | 20 +++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 Arduino_Code/kittybot.ino create mode 100644 Arduino_Code/setup.ino diff --git a/Arduino_Code/kittybot.ino b/Arduino_Code/kittybot.ino new file mode 100644 index 000000000..61eab8508 --- /dev/null +++ b/Arduino_Code/kittybot.ino @@ -0,0 +1,62 @@ +/* Sweep + by BARRAGAN + This example code is in the public domain. + + modified 8 Nov 2013 + by Scott Fitzgerald + http://www.arduino.cc/en/Tutorial/Sweep +*/ + +#include + + Servo s1,s2,s3,s4; // created on most boards + + +int pos = 0; // variable to store the servo position +int t=2000; +void setup() { + s1.attach(6);// attaches the servo on pin 9 to the servo object + s1.write(50); + s2.attach(5); + s2.write(90); + s3.attach(9); // attaches the servo on pin 9 to the servo object + s3.write(55); + s4.attach(3); + s4.write(90); +} + +void loop() { + + s1.write(30); + delay(t); + s1.write(40); + delay(t); + s3.write(95); + delay(t); + s1.write(50); + delay(t); + s3.write(75); + delay(t); + s4.write(50); + delay(t); + s3.write(55); + delay(t); + s4.write(70); + delay(t); + s2.write(110); + delay(t); + s4.write(90); + delay(t); + s2.write(90); + +//for (pos = 0; pos <= 180; pos += 90) { // goes from 0 degrees to 180 degrees +// // in steps of 1 degree +// myservo.write(pos); // tell servo to go to position in variable 'pos' +// delay(100); // waits 15ms for the servo to reach the position +// } +// for (pos = 180; pos >= 0; pos -= 90) { // goes from 180 degrees to 0 degrees +// myservo.write(pos); // tell servo to go to position in variable 'pos' +// delay(); // waits 15ms for the servo to reach the position +// } +} + diff --git a/Arduino_Code/setup.ino b/Arduino_Code/setup.ino new file mode 100644 index 000000000..7a4679c0a --- /dev/null +++ b/Arduino_Code/setup.ino @@ -0,0 +1,20 @@ +#include +Servo s1, s2, s3, s4; + +void setup() +{s1.attach(6);// attaches the servo on pin 9 to the servo object + s1.write(90); + s2.attach(5); + s2.write(90); + s3.attach(9); // attaches the servo on pin 9 to the servo object + s3.write(90); + s4.attach(3); + s4.write(90); + +} +void loop() +{ + s1.write(30); + s2.write(40); +} + From a03c0737dd3cad2811a9204063182dc233510742 Mon Sep 17 00:00:00 2001 From: Pranjal Mishra <39010495+Pranjal1751@users.noreply.github.com> Date: Fri, 26 Oct 2018 17:19:22 +0530 Subject: [PATCH 031/333] Add files via upload --- Other Algorithms/Reverse Number/numberreverse.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Other Algorithms/Reverse Number/numberreverse.cpp diff --git a/Other Algorithms/Reverse Number/numberreverse.cpp b/Other Algorithms/Reverse Number/numberreverse.cpp new file mode 100644 index 000000000..e331794d5 --- /dev/null +++ b/Other Algorithms/Reverse Number/numberreverse.cpp @@ -0,0 +1,14 @@ +//reversing a number +#include +using namespace std; +int main() +{int n,rev=0,num; +cout<<"Enter the no. to be reversed :" ; +cin>>num; +while(num) +{n=num%10; +rev=rev*10+n; +num=num/10; + } + cout<<"The reverse number is "< Date: Fri, 26 Oct 2018 17:24:05 +0530 Subject: [PATCH 032/333] Add files via upload --- Other Algorithms/conversion.cpp | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Other Algorithms/conversion.cpp diff --git a/Other Algorithms/conversion.cpp b/Other Algorithms/conversion.cpp new file mode 100644 index 000000000..1996010ee --- /dev/null +++ b/Other Algorithms/conversion.cpp @@ -0,0 +1,60 @@ +#include +#include +using namespace std; +int main() +{int n; +string c; +long octal(int); +long binary(int); +string hexa(int); +cout<<"Enter the no. to convert :"; +cin>>n; + + +cout<<"Binary Equivalent :"<=0;j--) + { str2=str2+str[j]; + } + return str2; + } From c0f1463d7327a9eed246f96391c444e88c0a1f41 Mon Sep 17 00:00:00 2001 From: Pranjal Mishra <39010495+Pranjal1751@users.noreply.github.com> Date: Fri, 26 Oct 2018 17:34:59 +0530 Subject: [PATCH 033/333] Add files via upload --- armstron.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 armstron.cpp diff --git a/armstron.cpp b/armstron.cpp new file mode 100644 index 000000000..3a940f8fd --- /dev/null +++ b/armstron.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; + +int main() +{ + int origNum, num, rem, sum = 0; + cout << "Enter a positive integer: "; + cin >> origNum; + + num = origNum; + + while(num != 0) + { + rem = num % 10; + sum += rem * rem * rem; + num /= 10; + } + + if(sum == origNum) + cout << origNum << " is an Armstrong number."; + else + cout << origNum << " is not an Armstrong number."; + + return 0; +} From 280affedc6ffc6817de532b30a5312194b399dd1 Mon Sep 17 00:00:00 2001 From: Kalp Kumar Varshney Date: Fri, 26 Oct 2018 18:58:19 +0530 Subject: [PATCH 034/333] Deleting a node from a tree --- Tree/Binary Search Tree/tree_delete_node.cpp | 145 +++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Tree/Binary Search Tree/tree_delete_node.cpp diff --git a/Tree/Binary Search Tree/tree_delete_node.cpp b/Tree/Binary Search Tree/tree_delete_node.cpp new file mode 100644 index 000000000..bc717b24c --- /dev/null +++ b/Tree/Binary Search Tree/tree_delete_node.cpp @@ -0,0 +1,145 @@ + +#include +#include + +struct node +{ + int key; + struct node *left, *right; +}; + +// A utility function to create a new BST node +struct node *newNode(int item) +{ + struct node *temp = (struct node *)malloc(sizeof(struct node)); + temp->key = item; + temp->left = temp->right = NULL; + return temp; +} + +// A utility function to do inorder traversal of BST +void inorder(struct node *root) +{ + if (root != NULL) + { + inorder(root->left); + printf("%d ", root->key); + inorder(root->right); + } +} + +/* A utility function to insert a new node with given key in BST */ +struct node* insert(struct node* node, int key) +{ + /* If the tree is empty, return a new node */ + if (node == NULL) return newNode(key); + + /* Otherwise, recur down the tree */ + if (key < node->key) + node->left = insert(node->left, key); + else + node->right = insert(node->right, key); + + /* return the (unchanged) node pointer */ + return node; +} + +/* Given a non-empty binary search tree, return the node with minimum + key value found in that tree. Note that the entire tree does not + need to be searched. */ +struct node * minValueNode(struct node* node) +{ + struct node* current = node; + + /* loop down to find the leftmost leaf */ + while (current->left != NULL) + current = current->left; + + return current; +} + +/* Given a binary search tree and a key, this function deletes the key + and returns the new root */ +struct node* deleteNode(struct node* root, int key) +{ + // base case + if (root == NULL) return root; + + // If the key to be deleted is smaller than the root's key, + // then it lies in left subtree + if (key < root->key) + root->left = deleteNode(root->left, key); + + // If the key to be deleted is greater than the root's key, + // then it lies in right subtree + else if (key > root->key) + root->right = deleteNode(root->right, key); + + // if key is same as root's key, then This is the node + // to be deleted + else + { + // node with only one child or no child + if (root->left == NULL) + { + struct node *temp = root->right; + free(root); + return temp; + } + else if (root->right == NULL) + { + struct node *temp = root->left; + free(root); + return temp; + } + + // node with two children: Get the inorder successor (smallest + // in the right subtree) + struct node* temp = minValueNode(root->right); + + // Copy the inorder successor's content to this node + root->key = temp->key; + + // Delete the inorder successor + root->right = deleteNode(root->right, temp->key); + } + return root; +} + +// Driver Program to test above functions +int main() +{ + /* Let us create following BST + 50 + / \ + 30 70 + / \ / \ + 20 40 60 80 */ + struct node *root = NULL; + root = insert(root, 50); + root = insert(root, 30); + root = insert(root, 20); + root = insert(root, 40); + root = insert(root, 70); + root = insert(root, 60); + root = insert(root, 80); + + printf("Inorder traversal of the given tree \n"); + inorder(root); + + printf("\nDelete 20\n"); + root = deleteNode(root, 20); + printf("Inorder traversal of the modified tree \n"); + inorder(root); + + printf("\nDelete 30\n"); + root = deleteNode(root, 30); + printf("Inorder traversal of the modified tree \n"); + inorder(root); + + printf("\nDelete 50\n"); + root = deleteNode(root, 50); + printf("Inorder traversal of the modified tree \n"); + inorder(root); + + \ No newline at end of file From a721c66d27bde3edeeec7a2d678103730a7ed6aa Mon Sep 17 00:00:00 2001 From: i-vishi Date: Fri, 26 Oct 2018 18:53:39 +0530 Subject: [PATCH 035/333] Delete bst.cpp --- Tree/Binary Search Tree/bst.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Tree/Binary Search Tree/bst.cpp diff --git a/Tree/Binary Search Tree/bst.cpp b/Tree/Binary Search Tree/bst.cpp deleted file mode 100644 index e69de29bb..000000000 From 0d9f2e166de6dae592a9d1ec54ea4826de2beecf Mon Sep 17 00:00:00 2001 From: i-vishi Date: Fri, 26 Oct 2018 19:03:55 +0530 Subject: [PATCH 036/333] Revert "Adding Traveling Salesman Problem in C++" --- Graphs/Traveling Salesman Problem/tsp.cpp | 56 ----------------------- 1 file changed, 56 deletions(-) delete mode 100644 Graphs/Traveling Salesman Problem/tsp.cpp diff --git a/Graphs/Traveling Salesman Problem/tsp.cpp b/Graphs/Traveling Salesman Problem/tsp.cpp deleted file mode 100644 index cef99f509..000000000 --- a/Graphs/Traveling Salesman Problem/tsp.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -using namespace std; - -double V[16][16]; -vector > P; -int n; - -double dp[20][1 << 16]; - -inline double calc(int i,int j){ - return sqrt((P[i].first-P[j].first)*(P[i].first-P[j].first) + (P[i].second - P[j].second)*(P[i].second - P[j].second)); -} - -double solve(int current, int mask){ - if(mask == ((1<<(n+1))-1)){ - return V[current][0]; - } - - if(dp[current][mask]!=-1) return dp[current][mask]; - - double ans = 1e9 + 10; - - for(int i=1;i<=n;i++){ - if(!(mask & (1<> n and n){ - P.clear(); - for(int i=0;i<=n;i++){ - for(int j=0;j<=(1<<(n+1));j++){ - dp[i][j] = -1; - } - } - cin >> x >> y; - P.push_back(make_pair(x,y)); - for(int i=1;i<=n;i++){ - cin >> a >> b; - P.push_back(make_pair(a,b)); - } - for(int i=0;i<=n;i++){ - for(int j=0;j<=n;j++){ - V[i][j] = calc(i,j); - } - } - cout << fixed << setprecision(2) << solve(0,1) << endl; - } -} - From eaa444f31ac629bcf3bf532cf31b2cb1121f95bd Mon Sep 17 00:00:00 2001 From: DaLeste777 <44482365+DaLeste777@users.noreply.github.com> Date: Fri, 26 Oct 2018 11:15:05 -0300 Subject: [PATCH 037/333] Create random.html --- Random Number/random.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Random Number/random.html diff --git a/Random Number/random.html b/Random Number/random.html new file mode 100644 index 000000000..ed65f5957 --- /dev/null +++ b/Random Number/random.html @@ -0,0 +1,16 @@ + + + Random Number + + + +

NUMERO

+ + + + + From 2bb40cfa597e19b0a75e47593603df461a393492 Mon Sep 17 00:00:00 2001 From: BhautikDonga <34915439+BhautikDonga@users.noreply.github.com> Date: Fri, 26 Oct 2018 19:50:22 +0530 Subject: [PATCH 038/333] Add files via upload --- .../EqualizeBitStrings.cpp | 34 ++++++++++++++++ .../EqualizingBitStrings/README.md | 9 +++++ Greedy Algorithms/Gas Station/README.md | 20 ++++++++++ .../Gas Station/containerShip.cpp | 40 +++++++++++++++++++ .../MaximumIncreasingSubarray.cpp | 35 ++++++++++++++++ .../ProblemStatement.md | 5 +++ 6 files changed, 143 insertions(+) create mode 100644 Greedy Algorithms/EqualizingBitStrings/EqualizeBitStrings.cpp create mode 100644 Greedy Algorithms/EqualizingBitStrings/README.md create mode 100644 Greedy Algorithms/Gas Station/README.md create mode 100644 Greedy Algorithms/Gas Station/containerShip.cpp create mode 100644 Greedy Algorithms/MaximumIncreasingSubarray/MaximumIncreasingSubarray.cpp create mode 100644 Greedy Algorithms/MaximumIncreasingSubarray/ProblemStatement.md diff --git a/Greedy Algorithms/EqualizingBitStrings/EqualizeBitStrings.cpp b/Greedy Algorithms/EqualizingBitStrings/EqualizeBitStrings.cpp new file mode 100644 index 000000000..155a25a73 --- /dev/null +++ b/Greedy Algorithms/EqualizingBitStrings/EqualizeBitStrings.cpp @@ -0,0 +1,34 @@ +#include + +typedef long long int lli; + +using namespace std; + +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + cout.precision(50); + string a, b; + lli n, i, x=0; + cin>>n>>a>>b; + for(i=0;i +using namespace std; + +int canCompleteCircuit(vector &A, vector &B){ +int n=A.size(); + if(n==1) + return 0; + int sum1=0,sum2=0,i,diff,maxa=0,maxele=0; + for(i=0;i gas,cost; + scanf("%d",&n); + printf("Enter gas at each station\n"); + for(i=0;i + +typedef long long int lli; + +using namespace std; + +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + cout.precision(50); + lli n; + cin >> n; + lli a[n]; + for(int i = 0; i> a[i]; + } + lli ans = 1; + lli out = 1; + for(int i = 1; i a[i-1]) + { + ans++; + } + else + { + ans = 1; + } + out = max(out,ans); + } + cout << out << endl; +} diff --git a/Greedy Algorithms/MaximumIncreasingSubarray/ProblemStatement.md b/Greedy Algorithms/MaximumIncreasingSubarray/ProblemStatement.md new file mode 100644 index 000000000..5e45317db --- /dev/null +++ b/Greedy Algorithms/MaximumIncreasingSubarray/ProblemStatement.md @@ -0,0 +1,5 @@ +### Maximum Increasing Subarray + +You are given array consisting of *n* integers. Your task is to find the maximum length of an increasing subarray of the given array. + +A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous. From ff905ee49c37f24b7eab0aacf69082b4d89ae394 Mon Sep 17 00:00:00 2001 From: ShuvamKedia Date: Fri, 26 Oct 2018 20:52:13 +0530 Subject: [PATCH 039/333] lca code added --- Graphs/LCA/lca.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Graphs/LCA/lca.cpp diff --git a/Graphs/LCA/lca.cpp b/Graphs/LCA/lca.cpp new file mode 100644 index 000000000..d893b46f1 --- /dev/null +++ b/Graphs/LCA/lca.cpp @@ -0,0 +1,77 @@ +#include +#include +using namespace std; +int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1}; +#define mod 1000000007 +#define CLEAR(a) memset((a),0,sizeof(a)) +#define ll long long int +#define pii pair +#define level 18 +vector tree[100000]; +int depth[100000]; +int parent[100000][18]; +void dfs(int cur, int prev) +{ + depth[cur] = depth[prev] + 1; + parent[cur][0] = prev; + for (int i=0; i>i)&1) + v = parent[v][i]; + if (u == v) + return u; + for (int i=level-1; i>=0; i--) + if (parent[u][i] != parent[v][i]) + { + u = parent[u][i]; + v = parent[v][i]; + } + return parent[u][0]; +} +int main() +{ + memset(parent,-1,sizeof(parent)); + int n; + cin>>n; + for(int i=0;i>a>>b; + tree[a].push_back(b); + tree[b].push_back(a); + } + depth[0] = 0; + dfs(1,0); + precomputeSparseMatrix(n); + int q; + cin>>q; + while(q--) + { + int a,b; + cin>>a>>b; + cout< Date: Fri, 26 Oct 2018 12:24:38 -0300 Subject: [PATCH 040/333] Create recur.py --- recur.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 recur.py diff --git a/recur.py b/recur.py new file mode 100644 index 000000000..12713ff4c --- /dev/null +++ b/recur.py @@ -0,0 +1,18 @@ +def main(): + print("Order = "+str(bubble_sort([9, 1, 2, 7, 4, 6, 5, 3]))) + +def bubble_sort(arr): + while True: + sorted = True + for i in range(len(arr)-1): + if(arr[i] > arr[i+1]): + buff = arr[i+1] + arr[i+1] = arr[i] + arr[i] = buff + sorted = False + if(sorted): + return arr + break + +if __name__ == "__main__": + main() From 180d6aa73aea4edbf39a638a86089cbea321d19a Mon Sep 17 00:00:00 2001 From: Rishabh Chaturvedi Date: Fri, 26 Oct 2018 20:56:20 +0530 Subject: [PATCH 041/333] Astar Algorithm --- Other Algorithms/AStar/astar.py | 115 ++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Other Algorithms/AStar/astar.py diff --git a/Other Algorithms/AStar/astar.py b/Other Algorithms/AStar/astar.py new file mode 100644 index 000000000..a4feaf290 --- /dev/null +++ b/Other Algorithms/AStar/astar.py @@ -0,0 +1,115 @@ +#Class Definition of Node +class Node(): + def __init__(self, parent=None, position=None): + self.parent = parent + self.position = position + + self.g = 0 + self.h = 0 + self.f = 0 + + def __eq__(self, other): + return self.position == other.position + +#return the path from start to end +def astar(maze, start, end): + + startNode = Node(None, start) + startNode.g = startNode.h = startNode.f = 0 + endNode = Node(None, end) + endNode.g = endNode.h = endNode.f = 0 + + # Initialize both open and closed list + openList = [] + closedList = [] + + # Add the start node + openList.append(startNode) + + # Loop until you find the end + while len(openList) > 0: + + # Get the current node + currentNode = openList[0] + currentIndex = 0 + for index, item in enumerate(openList): + if item.f < currentNode.f: + currentNode = item + currentIndex = index + + # Pop current off open list, add to closed list + openList.pop(currentIndex) + closedList.append(currentNode) + + # Goal Found + if currentNode == endNode: + path = [] + current = currentNode + while current is not None: + path.append(current.position) + current = current.parent + return path[::-1] # Return reversed path + + # Generating children + children = [] + for newPosition in [(0, -1), (0, 1), (-1, 0), (1, 0), (-1, -1), (-1, 1), (1, -1), (1, 1)]: # Adjacent squares + + # current Node position + nodePosition = (currentNode.position[0] + newPosition[0], currentNode.position[1] + newPosition[1]) + + ##In range + if nodePosition[0] > (len(maze) - 1) or nodePosition[0] < 0 or nodePosition[1] > (len(maze[len(maze)-1]) -1) or nodePosition[1] < 0: + continue + + # Make sure walkable path + if maze[nodePosition[0]][nodePosition[1]] != 0: + continue + + newNode = Node(currentNode, nodePosition) + + children.append(newNode) + + # Loop through children + for child in children: + + # Child is on the closed list + for closedChild in closedList: + if child == closedChild: + continue + + # Create the f, g, and h values + child.g = currentNode.g + 1 + child.h = ((child.position[0] - endNode.position[0]) ** 2) + ((child.position[1] - endNode.position[1]) ** 2) + child.f = child.g + child.h + + # Child is already in the open list + for openNode in openList: + if child == openNode and child.g > openNode.g: + continue + + # Add the child to the open list + openList.append(child) + + +def main(): + + maze = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] + + start = (0, 0) + end = (7, 6) + + path = astar(maze, start, end) + print(path) + + +if __name__ == '__main__': + main() \ No newline at end of file From fa9ad38abf237d3edd5873ec503d3e2d593244cc Mon Sep 17 00:00:00 2001 From: Arjun Shibu <43996156+dar0ng1@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:05:29 +0530 Subject: [PATCH 042/333] Add _factorial.py Prints factorial of a number without recursion --- Mathematics/factorial/python/_factorial.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Mathematics/factorial/python/_factorial.py diff --git a/Mathematics/factorial/python/_factorial.py b/Mathematics/factorial/python/_factorial.py new file mode 100644 index 000000000..9a25333e6 --- /dev/null +++ b/Mathematics/factorial/python/_factorial.py @@ -0,0 +1,9 @@ +def factorial(number): + fact = 1 + while number > 0: + fact *= number + number -= 1 + return fact + +n = int(input("Enter the number: ")) +print("%d! = %d" %(n, factorial(n))) From a4d4e513acacc9ccb5ed7453912683c296970efb Mon Sep 17 00:00:00 2001 From: DaLeste777 <44482365+DaLeste777@users.noreply.github.com> Date: Fri, 26 Oct 2018 12:36:22 -0300 Subject: [PATCH 043/333] Rename fibonacci.py to fib.py --- Dynamic Programming/fibonacci/python/fib.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Dynamic Programming/fibonacci/python/fib.py diff --git a/Dynamic Programming/fibonacci/python/fib.py b/Dynamic Programming/fibonacci/python/fib.py new file mode 100644 index 000000000..e23a573eb --- /dev/null +++ b/Dynamic Programming/fibonacci/python/fib.py @@ -0,0 +1,7 @@ +def Fib(n): + n = int(input("Entre com o valor:")) + if n == 1 or n == 2: + return 1 + else: + return(n-2) + (n-1) +print(Fib()) From 5fce2db337d9b6ff80353d7fe4f0a8a9459dd3e5 Mon Sep 17 00:00:00 2001 From: DaLeste777 <44482365+DaLeste777@users.noreply.github.com> Date: Fri, 26 Oct 2018 12:46:47 -0300 Subject: [PATCH 044/333] Update fib.py --- Dynamic Programming/fibonacci/python/fib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dynamic Programming/fibonacci/python/fib.py b/Dynamic Programming/fibonacci/python/fib.py index e23a573eb..f24f14557 100644 --- a/Dynamic Programming/fibonacci/python/fib.py +++ b/Dynamic Programming/fibonacci/python/fib.py @@ -1,5 +1,5 @@ def Fib(n): - n = int(input("Entre com o valor:")) + n = int(input("Enter a value:")) if n == 1 or n == 2: return 1 else: From 0c4e89558d27480fdf743e3409b25320bed4f1ed Mon Sep 17 00:00:00 2001 From: Arjun Shibu <43996156+dar0ng1@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:25:15 +0530 Subject: [PATCH 045/333] Added guess_number.php A simple PHP based guessing game, where user guesses a number from 1 to 10. The computer generates a random number from 1 to 10. If the number that the user enters matches the number that the computer generates, the user has guessed the correct number. If the number that the user has entered does not match the number that the computer has generated, the user is told that this is the incorrect number and to try again. --- Random Number/guess_number.php | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Random Number/guess_number.php diff --git a/Random Number/guess_number.php b/Random Number/guess_number.php new file mode 100644 index 000000000..c14d471f4 --- /dev/null +++ b/Random Number/guess_number.php @@ -0,0 +1,38 @@ + + + +
+Guess a Number Between 1 and 10: +

+ +Result: + 0) && ($number <11)){ +if ($number != $randomNumber) +{ +echo "Incorrect guess. The correct number was $randomNumber. Try again"; +} +else +{ +echo "$randomNumber is the correct guess. You got it right."; +} +} + +} + +?> +

+

+
From 122bdb2f025a4e6cc10025376d36518269565a53 Mon Sep 17 00:00:00 2001 From: Rishabh Chaturvedi Date: Fri, 26 Oct 2018 20:56:20 +0530 Subject: [PATCH 046/333] Issue #163 Adding Astar Algorithm --- Other Algorithms/AStar/astar.py | 115 ++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Other Algorithms/AStar/astar.py diff --git a/Other Algorithms/AStar/astar.py b/Other Algorithms/AStar/astar.py new file mode 100644 index 000000000..a4feaf290 --- /dev/null +++ b/Other Algorithms/AStar/astar.py @@ -0,0 +1,115 @@ +#Class Definition of Node +class Node(): + def __init__(self, parent=None, position=None): + self.parent = parent + self.position = position + + self.g = 0 + self.h = 0 + self.f = 0 + + def __eq__(self, other): + return self.position == other.position + +#return the path from start to end +def astar(maze, start, end): + + startNode = Node(None, start) + startNode.g = startNode.h = startNode.f = 0 + endNode = Node(None, end) + endNode.g = endNode.h = endNode.f = 0 + + # Initialize both open and closed list + openList = [] + closedList = [] + + # Add the start node + openList.append(startNode) + + # Loop until you find the end + while len(openList) > 0: + + # Get the current node + currentNode = openList[0] + currentIndex = 0 + for index, item in enumerate(openList): + if item.f < currentNode.f: + currentNode = item + currentIndex = index + + # Pop current off open list, add to closed list + openList.pop(currentIndex) + closedList.append(currentNode) + + # Goal Found + if currentNode == endNode: + path = [] + current = currentNode + while current is not None: + path.append(current.position) + current = current.parent + return path[::-1] # Return reversed path + + # Generating children + children = [] + for newPosition in [(0, -1), (0, 1), (-1, 0), (1, 0), (-1, -1), (-1, 1), (1, -1), (1, 1)]: # Adjacent squares + + # current Node position + nodePosition = (currentNode.position[0] + newPosition[0], currentNode.position[1] + newPosition[1]) + + ##In range + if nodePosition[0] > (len(maze) - 1) or nodePosition[0] < 0 or nodePosition[1] > (len(maze[len(maze)-1]) -1) or nodePosition[1] < 0: + continue + + # Make sure walkable path + if maze[nodePosition[0]][nodePosition[1]] != 0: + continue + + newNode = Node(currentNode, nodePosition) + + children.append(newNode) + + # Loop through children + for child in children: + + # Child is on the closed list + for closedChild in closedList: + if child == closedChild: + continue + + # Create the f, g, and h values + child.g = currentNode.g + 1 + child.h = ((child.position[0] - endNode.position[0]) ** 2) + ((child.position[1] - endNode.position[1]) ** 2) + child.f = child.g + child.h + + # Child is already in the open list + for openNode in openList: + if child == openNode and child.g > openNode.g: + continue + + # Add the child to the open list + openList.append(child) + + +def main(): + + maze = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] + + start = (0, 0) + end = (7, 6) + + path = astar(maze, start, end) + print(path) + + +if __name__ == '__main__': + main() \ No newline at end of file From cfd3ad0fbfcda9a82db982de0c2fe1676e89ba97 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Fri, 26 Oct 2018 21:59:55 +0530 Subject: [PATCH 047/333] Heavy Light Decomposition Algo in c++ --- Graphs/HLD/hld.txt | 133 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Graphs/HLD/hld.txt diff --git a/Graphs/HLD/hld.txt b/Graphs/HLD/hld.txt new file mode 100644 index 000000000..aaaa2ab20 --- /dev/null +++ b/Graphs/HLD/hld.txt @@ -0,0 +1,133 @@ +// chain formation + +#inclue +using namespace std; +#define sz 100005 +vectorgr[sz]; + +int no=0; //count number of chains existing +int head[sz]; // head of each chain +int ind[sz]; // chain no. of a node +int pos[sz]; // position of a node in its chain +int csize[sz]; //size of a particular chain +int sub[sz],par[sz]; +void dfs(int src,int parent){ + sub[src]=1; + par[src]=parent; + for(int i=0;i<(int)gr[src].size();++i){ + int ver=gr[src][i]; + if(ver==parent) continue; + dfs(ver,src); + } + sub[parent]+=sub[src]; +} + +void hld(int src){ + if(head[no]==-1) head[no]=src; + ind[src]=no; + pos[src]=csize[no]; + csize[no]++; + + int ind=-1,mx=0; // if ind=0 then index problem in subtree + + for(int i=0;i<(int)gr[src].size();++i){ + int ver=gr[src][i]; + if(ver==par[src]) continue; + if(sub[ver]>=mx){ + mx=sub[ver]; + ind=i; + } + } + + if(ind>=0) hld(gr[src][ind]); //special child i.e subtree is mazmum + + for(int i=0;i<(int)gr[src].size();++i){ //other will be other chain + int ver=gr[src][i]; + if(ver==par[src] or i==ind) continue; + ++no; + hld(ver); + } + + +} + + + + +int LCA(int u,int v){ + + if(lv[u]>lv[v]) swap(u,v); + int diff=abs(lv[u]-lv[v]); + + for(int i=13;i>=0;--i) + if((1<=0;--i){ + if(par[v][i]!=par[u][i]){ + v=par[v][i]; + u=par[u][i]; + } + } + return par[u][0]; + +} + + +//LCA IN HLD + + + +int up_qry(int u,int v){ + + if(u==v) return 0; + int uchain=ind[u],vchain=ind[v]; + int ans=-1; + while(1){ + uchain=ind[u]; + if(uchain==vchain){ + if(u==v) break; + segqry(1,1,ptr-1,inpos[v],inpos[u]); // according to need + if(qt[1]>ans) ans=qt[1]; + break; + } + segqry(1,1,ptr-1,inpos[head[uchain]],inpos[u]); // chkpt + if(qt[1]>ans) ans=qt[1]; + + u=head[uchain]; + u=par[u][0]; + + } + return ans; + +} + + +void qry(int u,int v){ + int lca=LCA(u,v); + return max(up_qry(u,lca),up_qry(v,lca)); +} + + +void upd(int node,int s,int e,int ind,int val){ + + if(s==e){ + seg[node]=val; + return; + } + int mid=(s+e)>>1; + if(ind<=mid) upd(2*node,s,mid,ind,val); + else upd(2*node+1,mid+1,e,ind,val); + + seg[node]=max(seg[2*node],seg[2*node+1]); + +} + +void segqry(int node,int s,int e,int l,int r){ + + if(r>1; + return max(segqry(2*node,s,mid,l,r),segqry(2*node+1,mid+1,e,l,r)); +} \ No newline at end of file From 34d776f8a7e56107b19ba89510cb45d307808259 Mon Sep 17 00:00:00 2001 From: MuriloAndre2000 <40254653+MuriloAndre2000@users.noreply.github.com> Date: Fri, 26 Oct 2018 13:33:27 -0300 Subject: [PATCH 048/333] Check if one number is a prime number --- Mathematics/prime_numbers.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Mathematics/prime_numbers.py diff --git a/Mathematics/prime_numbers.py b/Mathematics/prime_numbers.py new file mode 100644 index 000000000..207dee90e --- /dev/null +++ b/Mathematics/prime_numbers.py @@ -0,0 +1,20 @@ + + +print("Type a number") +n = input() +a = 2 +b = True + + +while a < int(n): + if int(n) % a == 0 : + print("n is not a prime number!") + a = int(n) + b = False + + a = a + 1 + + + +if b == True: + print("n is a prime number!") From 61f804b6a639eb8acb5113a412ec77e814f782e9 Mon Sep 17 00:00:00 2001 From: santhu33 <44506285+santhu33@users.noreply.github.com> Date: Fri, 26 Oct 2018 22:23:40 +0530 Subject: [PATCH 049/333] Update armstron.cpp --- armstron.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/armstron.cpp b/armstron.cpp index 3a940f8fd..9d06c79c8 100644 --- a/armstron.cpp +++ b/armstron.cpp @@ -1,16 +1,16 @@ #include using namespace std; -int main() +int main(void) { - int origNum, num, rem, sum = 0; + int origNum, num,sum = 0; cout << "Enter a positive integer: "; cin >> origNum; num = origNum; - while(num != 0) - { + while(num) + {int rem; rem = num % 10; sum += rem * rem * rem; num /= 10; From bf603a0315112d79a8bf1b7e9c1377544c82840f Mon Sep 17 00:00:00 2001 From: stray128 Date: Fri, 26 Oct 2018 23:11:23 +0530 Subject: [PATCH 050/333] Create knowledge_graph.py --- Graphs/knowledge_graph.py | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Graphs/knowledge_graph.py diff --git a/Graphs/knowledge_graph.py b/Graphs/knowledge_graph.py new file mode 100644 index 000000000..98bcb12cc --- /dev/null +++ b/Graphs/knowledge_graph.py @@ -0,0 +1,76 @@ +import webbrowser +import spacy +nlp = spacy.load('en_core_web_sm') +from py2neo import Node, Relationship, Graph + + +## Importing the data +with open ("umls/entities.txt", "r") as myfile: + entities = myfile.readlines() +for i in range(len(entities)): + entities[i] = entities[i].split() + +with open ("umls/entity_category.txt", "r") as myfile: + entity_category = myfile.readlines() +for i in range(len(entity_category)): + entity_category[i] = entity_category[i].split() + +with open ("umls/relations.txt", "r") as myfile: + relations = myfile.readlines() +for i in range(len(relations)): + relations[i] = relations[i].split() + + +with open ("umls/triples.txt", "r") as myfile: + triples = myfile.readlines() +for i in range(len(triples)): + triples[i] = triples[i].split() + +## getting entity_to_id and id_to_entity +entity_to_id = {} +id_to_entity = {} +for i in entities: + entity_to_id[i[1]] = i[0] + id_to_entity[i[0]] = i[1] + +## getting category_to_id and id_to_category +category_to_id = {} +id_to_category = {} +for i in entity_category: + category_to_id[i[1]] = i[0] + id_to_category[i[0]] = i[1] + +## getting relation_to_id and id_to_relation +relation_to_id = {} +id_to_relation = {} +for i in relations: + relation_to_id[i[1]] = i[0] + id_to_relation[i[0]] = i[1] + +## Creating Nodes +nodes_e = [] +nodes_c = [] +for i in range(len(entities)): + nodes_e.append(Node('Entity',name = entities[i][1],id_e = entity_to_id[entities[i][1]])) +for i in range(len(entity_category)): + nodes_c.append(Node('Category',name = entity_category[i][1],id_c = category_to_id[entity_category[i][1]])) + +relationships = [] +for i in triples: + relationship = Relationship(nodes_e[int(i[1])],id_to_relation[i[0]].replace('-','_'),nodes_e[int(i[2])]) + relationships.append(relationship) + +# CReating the graph +graph =Graph(host='localhost',user='neo4j', password=None) # initial graph from the data +#graph = Graph('bolt://neo4j:test@127.0.0.1:7687/db/data') +tx = graph.begin() + +for node in nodes_e: + tx.create(node) +for relationship in relationships: + tx.create(relationship) + +tx.commit() + +#url = 'http://localhost:7474' +#webbrowser.open(url, new=2) # new=2 opens a new tab From e40e27d2daae466a6f94955b868350e19e6c5c87 Mon Sep 17 00:00:00 2001 From: MadushikaNB Date: Fri, 26 Oct 2018 23:18:26 +0530 Subject: [PATCH 051/333] mnb LinkedList-java algo first commit --- LinkedList/LinkList.class | Bin 0 -> 1296 bytes LinkedList/LinkList.java | 66 ++++++++++++++++++++++++++++++++++++++ LinkedList/Node.class | Bin 0 -> 448 bytes LinkedList/Node.java | 14 ++++++++ LinkedList/Run.class | Bin 0 -> 610 bytes LinkedList/Run.java | 21 ++++++++++++ 6 files changed, 101 insertions(+) create mode 100644 LinkedList/LinkList.class create mode 100644 LinkedList/LinkList.java create mode 100644 LinkedList/Node.class create mode 100644 LinkedList/Node.java create mode 100644 LinkedList/Run.class create mode 100644 LinkedList/Run.java diff --git a/LinkedList/LinkList.class b/LinkedList/LinkList.class new file mode 100644 index 0000000000000000000000000000000000000000..8265dcdaab094b87e7dc917e756e0f26f13bf9fc GIT binary patch literal 1296 zcmZux*-leY6kVsiaC^&TDip*57MV&1>WDI_ATepu)&XPW$z13Wua>qc#o?X*@J(JF z5E4y%`-=Dq!xP*luLKw2pj$socLHIFhafw+N zL)=6n2opmABxO&@GA>Ixh;uj}z=Z%VO86xcJti(I7*DiQP-x8N%LP5n!;D*UYu6O~ zv9Skq-=tZgHS3mieq(J}SMNK^MOp&1Jj=T4HKw?wbzSAbh-JK-$8L!wE#CfCZCd!@HWJpNHjcc50To2Wc?GLR7+ z{~<)B6`@xwk@5cs$$M};St^48zQ7P)q=HYz!c!y9oD$b=-uk#J?hWx>sCQoAse>R% zQs_AhJNa@pvaFx;z`GEc0&wYk}DY6SAmyB=2_mNmh7I=@w z&oGyE5eQj32u60$v;%tw%}15HSQD`L2~tKAnKUDf7S`|ehzrUiq8r@L7_%xb_4BDc zbo54Eqb0SChWw^aZSDU^y=90GBCVglGq9YGeKFV(i)BM3+)ZyE$@kMsNxxtz6K6UI z7Cn^ofmuT7p32q1avq{FVI+yQhpwP?{-y3r#7BU@O># zP|JbnI=?9j1TlS_oq<8}8=_@|jAP^$rze47B)N{`BHJ;C^T_aYm;XA#y%ol9w39l& zswZqxz`)@QH76p|8W%Fz#2!YEjiHreNNl6+a1y*UWViOe$wcbp>Jyn{6Q)UQhD2tO U!gUYWg6}69h&oEhvtG*JA1z+){{R30 literal 0 HcmV?d00001 diff --git a/LinkedList/LinkList.java b/LinkedList/LinkList.java new file mode 100644 index 000000000..242b2b514 --- /dev/null +++ b/LinkedList/LinkList.java @@ -0,0 +1,66 @@ +public class LinkList{ + private Node head; + + public void LinkList(){ + head=null; + } + + public void insert(int i){ + Node newNode = new Node(i); + newNode.next = head; + head = newNode; + + System.out.println("New Node Inserted : "+i); + } + + public Node find(int key){ + int i=1; + Node current = null; + + current = head; + + while(current != null && i != key){ + current = current.next; + i++; + } + + return current; + + } + + public void delete(int key){ + Node current = null; + Node previous = null; + + current = head; + previous = head; + + int i = 1; + + while(current.next != null && i != key){ + + previous = current; + current = current.next; + i++; + } + if(current==head){ + head = head.next; + }else{ + previous.next = current.next; + } + System.out.println("Item Deleted"); + } + + public void display(){ + Node current; + + current = head; + + while(current != null){ + System.out.println("Node : "+ current.item); + current = current.next; + } + } + + +} \ No newline at end of file diff --git a/LinkedList/Node.class b/LinkedList/Node.class new file mode 100644 index 0000000000000000000000000000000000000000..51ef845444b67a061d3a33722b4352cb21773f90 GIT binary patch literal 448 zcmZut%SyvQ6g`vHOp{DaAJ$iWZ>(9Eh3*tLf>0<`sJKttL8hchNfWW3rC0?Qet;h( z-iZZWxVdxhx#ygFn9r~G4*;h)u)(on!9+usRSRoax3PgujwZ(zLs6x2%)r{zM)EOb zFgx9ND9@-lSCL9DXwhmP-O+PNID^|!k?dyUzD#a|en^NjRMSZq%(RZ7(9&eP7iY;p zUMWqm^yYXJJOly)Re=&L0UHj-w!jW{IraqhQKln5CKXNg!yvl%ulpl8pj>~T-fWtu zF2orv8l9Z1V*e&lQQAur8H_1^{U4ZtPc$iv=$uKP0~laB4|S9p&H@oA)4WX62{8vWHE^w*VP^4;76r9^`d)ws#Ra!*86s=k)wu&VFfDjD{3CV(n5)0*~`DP(KQUlhFUUdJj-1}?Vy!*1L555soEj@J!ctT0{s7Mz4X z!)6r5$IVvKck%It2>n)X*gvv6PRNCWVcZa!!8j&ZbKH->4HARrs2aS$guzR^(x@3M zV@0EGu!`3j4TGjI-k?fL9HUUW+xMw`VviD Date: Fri, 26 Oct 2018 23:48:23 +0530 Subject: [PATCH 052/333] Added Floyd's Algorithm in Graphs/Java --- Graphs/Floyd/Java/Floyds.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Graphs/Floyd/Java/Floyds.java diff --git a/Graphs/Floyd/Java/Floyds.java b/Graphs/Floyd/Java/Floyds.java new file mode 100644 index 000000000..45571ba3c --- /dev/null +++ b/Graphs/Floyd/Java/Floyds.java @@ -0,0 +1,32 @@ +import java.util.Scanner; + +public class Floyds { + public static int min(int a,int b){ + return a>b?b:a; + } + + public static void main(String args[]){ + Scanner in = new Scanner(System.in); + System.out.print("\nEnter the number of nodes: "); + int n = in.nextInt(); + int [][]mat = new int[n][n]; + System.out.println("Enter the matrix"); + for(int i=0;i Date: Fri, 26 Oct 2018 20:21:53 +0200 Subject: [PATCH 053/333] Added a linke list implementation and unit test in C#. --- .../linked list/cs/LinkedList/LinkedList.cs | 50 +++++++++++++++++++ .../cs/LinkedList/LinkedList.csproj | 7 +++ .../cs/LinkedListTest/LinkedListTest.cs | 31 ++++++++++++ .../cs/LinkedListTest/LinkedListTest.csproj | 20 ++++++++ 4 files changed, 108 insertions(+) create mode 100644 data structures/linked list/cs/LinkedList/LinkedList.cs create mode 100644 data structures/linked list/cs/LinkedList/LinkedList.csproj create mode 100644 data structures/linked list/cs/LinkedListTest/LinkedListTest.cs create mode 100644 data structures/linked list/cs/LinkedListTest/LinkedListTest.csproj diff --git a/data structures/linked list/cs/LinkedList/LinkedList.cs b/data structures/linked list/cs/LinkedList/LinkedList.cs new file mode 100644 index 000000000..281eef28d --- /dev/null +++ b/data structures/linked list/cs/LinkedList/LinkedList.cs @@ -0,0 +1,50 @@ +using System; + +namespace Collections { + + public class Node { + internal T Data { get; set; } + internal Node Successor { get; set; } + + internal Node (T data) { + Data = data; + } + } + + public class LinkedList { + private Node Head { get; set; } + + public T this [int index] { + get { + int i = 0; + Node current = Head; + + if (current == null) { + throw new IndexOutOfRangeException (); + } + + while (i < index) { + if (current.Successor == null) { + throw new IndexOutOfRangeException (); + } + current = current.Successor; + i++; + } + + return current.Data; + } + } + public void Append (T data) { + Node newNode = new Node (data); + if (Head == null) { + Head = newNode; + } else { + Node current = Head; + while (current.Successor != null) { + current = current.Successor; + } + current.Successor = newNode; + } + } + } +} \ No newline at end of file diff --git a/data structures/linked list/cs/LinkedList/LinkedList.csproj b/data structures/linked list/cs/LinkedList/LinkedList.csproj new file mode 100644 index 000000000..72764a664 --- /dev/null +++ b/data structures/linked list/cs/LinkedList/LinkedList.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/data structures/linked list/cs/LinkedListTest/LinkedListTest.cs b/data structures/linked list/cs/LinkedListTest/LinkedListTest.cs new file mode 100644 index 000000000..c9e70c230 --- /dev/null +++ b/data structures/linked list/cs/LinkedListTest/LinkedListTest.cs @@ -0,0 +1,31 @@ +using System; +using Collections; +using Xunit; + +namespace LinkedListTest { + public class UnitTest1 { + [Fact] + public void TestAppendOneItem () { + LinkedList list = new LinkedList (); + list.Append (42); + Assert.Equal (42, list[0]); + } + + [Fact] + public void TestAppendMultipleItem () { + LinkedList list = new LinkedList (); + list.Append (42); + list.Append (23); + list.Append (1337); + Assert.Equal (42, list[0]); + Assert.Equal (23, list[1]); + Assert.Equal (1337, list[2]); + } + + [Fact] + public void TestIndexOutOfRangeException () { + LinkedList list = new LinkedList (); + Assert.Throws(() => list[0]); + } + } +} \ No newline at end of file diff --git a/data structures/linked list/cs/LinkedListTest/LinkedListTest.csproj b/data structures/linked list/cs/LinkedListTest/LinkedListTest.csproj new file mode 100644 index 000000000..6e1093f96 --- /dev/null +++ b/data structures/linked list/cs/LinkedListTest/LinkedListTest.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.1 + + false + + + + + + + + + + + + + + From c7f135278e08fbe932807c78306137ba6bee9202 Mon Sep 17 00:00:00 2001 From: Nikhil Rathore <35673596+nikcodes@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:23:38 +0530 Subject: [PATCH 054/333] added memoization for faster computation --- .../Fibonacci/Python/fibonacci.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Recursive Algorithms/Fibonacci/Python/fibonacci.py b/Recursive Algorithms/Fibonacci/Python/fibonacci.py index 07866cb3b..d8a0f50de 100644 --- a/Recursive Algorithms/Fibonacci/Python/fibonacci.py +++ b/Recursive Algorithms/Fibonacci/Python/fibonacci.py @@ -1,5 +1,14 @@ def fib(n): - if n <= 1: - return n - else: - return(fib(n-1) + fib(n-2)) + if n <= 1: + return n + if a[n]: + return a[n] + else: + ans = fib(n - 1) + fib(n - 2) + a[n] = ans + return ans + + +n = int(input("Enter a number\n")) +a = [0] * (n + 1) +print(fib(n)) From 8f37bdb51e5ab640c110399e18940032767230f6 Mon Sep 17 00:00:00 2001 From: bhavy007 <44473716+bhavy007@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:24:54 +0530 Subject: [PATCH 055/333] added Brainf*** Algorithm for x = pseudo-random number --- Random Number/random.bf | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Random Number/random.bf diff --git a/Random Number/random.bf b/Random Number/random.bf new file mode 100644 index 000000000..2dfb3bf64 --- /dev/null +++ b/Random Number/random.bf @@ -0,0 +1,36 @@ +temp0[-] +temp1[-] +temp2[-] +temp3[-] +temp4[-] +temp5[-] +randomh[temp0+randomh-] +randoml[temp1+randoml-] +temp3+++++++[temp2+++++++++++@temp3-] +temp2[ + temp0[randomh+temp3+temp0-] + temp3[temp0+temp3-] + temp1[randomh+temp3+temp4+temp1-] + temp4[temp1+temp4-] + temp3[ + randoml+[temp4+temp5+randoml-] + temp5[randoml+temp5-]+ + temp4[temp5-temp4[-]] + temp5[randomh+temp5-] + temp3-] +temp2-] +++++++[temp3++++++++temp2-] +temp3-[ + temp1[randomh+temp2+temp1-] + temp2[temp1+temp2-] +temp3-] +temp0[-]temp1[-]+++++[temp0+++++temp1-] +temp0[ + randoml+[temp1+temp2+randoml-] + temp2[randoml+temp2-]+ + temp1[temp2-temp1[-]] + temp2[randomh+temp2-] +temp0-] +++++++[randomh+++++++++temp0-] +randomh[x+temp0+randomh-] +temp0[randomh+temp0-] From 06cdd13b9cb68f75bd4dc8939f83fed4f0344445 Mon Sep 17 00:00:00 2001 From: eashsaxena <44508862+eashsaxena@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:34:07 +0530 Subject: [PATCH 056/333] added recursive function in Factorial.c --- Recursive Algorithms/Factorial.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/Recursive Algorithms/Factorial.c b/Recursive Algorithms/Factorial.c index 0484b9414..e117d6167 100644 --- a/Recursive Algorithms/Factorial.c +++ b/Recursive Algorithms/Factorial.c @@ -1,24 +1,19 @@ #include - +long int multiplyNumbers(int n); int main() { - int num, ans; - int fact=1,i=1; - int factorial(int n); - - printf("Enter number whose factorial is to be found\n"); - scanf("%d",&num); - ans=factorial(num); - printf("factorial is %d",ans); - - return 0; + int n; + printf("Enter a positive integer: "); + scanf("%d", &n); + printf("Factorial of %d = %ld", n, multiplyNumbers(n)); + return 0; +} +long int multiplyNumbers(int n) +{ + if (n >= 1) + return n*multiplyNumbers(n-1); + else + return 1; } -int factorial(int n){ - int res=n; - if (res=0|| res=1) return 1; - if (res>1){ - res*=factorial(n-1); - } - return res; } From 91ac41f29cad692b4f8d294bff3858da917f30c3 Mon Sep 17 00:00:00 2001 From: eashsaxena <44508862+eashsaxena@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:40:59 +0530 Subject: [PATCH 057/333] update code --- Tree/AVLTree/AVL_Tree.cpp | 505 ++++++++++++-------------------------- 1 file changed, 151 insertions(+), 354 deletions(-) diff --git a/Tree/AVLTree/AVL_Tree.cpp b/Tree/AVLTree/AVL_Tree.cpp index 5cea1f113..3790c5fbf 100644 --- a/Tree/AVLTree/AVL_Tree.cpp +++ b/Tree/AVLTree/AVL_Tree.cpp @@ -1,354 +1,151 @@ -#include "AVL.hpp" -#include -using namespace std; - -inline int max(int a, int b) { - return (a>b)? a: b; -} - -template -int height(AVLnode* N) { - if(N== nullptr) - return 0; - return N->height; -} - -template -AVLnode* newNode(Key key, Value value) { - AVLnode* node = (AVLnode*)malloc(sizeof(AVLnode)); - node->key = key; - node->val = value; - node->left = nullptr; - node->right = nullptr; - node->height = 1; - return node; -} - -template -AVLnode* rightRotate(AVLnode *y) { - AVLnode *x = y->left; - AVLnode *T2 = x->right; - x->right = y; - y->left = T2; - y->height = max(height(y->left),height(y->right))+1; - x->height = max(height(x->left),height(x->right))+1; - return x; -} - -template -AVLnode* leftRotate(AVLnode *x) { - AVLnode *y = x->right; - AVLnode *T2 = y->left; - y->left = x; - x->right = T2; - x->height = max(height(x->left),height(x->right))+1; - y->height = max(height(y->left),height(y->right))+1; - return y; -} - -template -int getBalance(AVLnode* N) { - if(N== nullptr) - return 0; - return height(N->left)-height(N->right); -} - -template -AVLnode* insert(AVLnode* node, Key key, Value value) { - if(node== nullptr) - return newNode(key,value); - if (key <= node->key) - node->left = insert(node->left,key,value); - else if(key > node->key) - node->right = insert(node->right,key,value); - else - return node; - - node->height = 1 + max(height(node->left),height(node->right)); - int balance = getBalance(node); - - if(balance>1 && keyleft->key) - return rightRotate(node); - if(balance<-1 && key>node->right->key) - return leftRotate(node); - if(balance>1 && key>node->left->key) { - node->left = leftRotate(node->left); - return rightRotate(node); - } - if(balance<-1 && key < node->right->key) { - node->right = rightRotate(node->right); - return leftRotate(node); - } - return node; -} - -template -AVLnode* minValueNode(AVLnode* node) { - AVLnode* current = node; - while (current->left!= nullptr) - current = current->left; - return current; -} - -template -AVLnode* deleteNode(AVLnode* root, Key key) { - if(root== nullptr) - return root; - if(keykey) - root->left = deleteNode(root->left,key); - else if (key>root->key) - root->right = deleteNode(root->right,key); - else { - if((root->left == nullptr) || (root->right== nullptr)) { - AVLnode* temp = root->left?root->left:root->right; - if(temp== nullptr) { - temp = root; - root = nullptr; - } - else - *root = *temp; - free(temp); - } - else { - AVLnode *temp = minValueNode(root->right); - root->key = temp->key; - root->right = deleteNode(root->right, temp->key); - } - } - - if (root == nullptr) - return root; - - root->height = 1+max(height(root->left),height(root->right)); - int balance = getBalance(root); - if (balance>1 && getBalance(root->left) >=0) - return rightRotate(root); - if(balance>1 && getBalance(root->left) < 0) { - root->left = leftRotate(root->left); - return rightRotate(root); - } - if(balance<-1 && getBalance(root->right) <= 0) - return leftRotate(root); - if(balance<-1 && getBalance(root->right) > 0) { - root->right = rightRotate(root->right); - return leftRotate(root); - } - return root; -} -template -void preOrder(AVLnode *root) { - if(root!= nullptr) { - cout << root->key << " " << root->val << endl; - preOrder(root->left); - preOrder(root->right); - } -} -template -AVLnode* Find(Key key, AVLnode* node) { - if (node->key == key) - return node; - else if (node->key > key) { - if (node->left != nullptr) - return Find(key, node->left); - return node; - } else if (node->key < key) { - if (node->right != nullptr) - return Find(key, node->right); - return node; - } -} -template -void inOrder(AVLnode* node) { - if(node== nullptr) - return; - else { - inOrder(node->left); - cout << node->key << " " << node->val << endl; - inOrder(node->right); - } -} -template -void postOrder(AVLnode* node) { - if(node== nullptr) - return; - else { - postOrder(node->left); - postOrder(node->right); - cout << node->key << " " << node->val << endl; - } -} -template -AVLnode* maxValueNode(AVLnode* node) { - AVLnode* current = node; - while (current->right!= nullptr) - current = current->right; - return current; -} -template -void inOrderPredecesor(AVLnode* root, AVLnode*& pre, Key key) { - if(root== nullptr) return; - if(root->key==key) { - if(root->left!= nullptr) { - pre = maxValueNode(root->left); - } - } - else if(root->key > key) { - inOrderPredecesor(root->left,pre,key); - } - else { - pre = root; - inOrderPredecesor(root->right,pre,key); - } -} -template -void inOrderSuccessor(AVLnode* root, AVLnode*& suc, Key key) { - if(root== nullptr) return; - - if (root->key == key) { - if(root->right!= nullptr) { - AVLnode* tmp = root->right; - while(tmp->left) - tmp = tmp->left; - suc = tmp; - } - } - - else if(root->key > key) { - suc = root; - inOrderSuccessor(root->left,suc,key); - } - else { - inOrderSuccessor(root->right,suc,key); - } -} -template -int count(AVLnode* n) { - int c = 1; - if(n== nullptr) - return 0; - else { - c += count(n->left); - c += count(n->right); - return c; - } -} -template -void AVL::put(const Key &key, const Value &value) { - AVLnode* current = root; - current = insert(current,key,value); - root = current; -} -template -void AVL::print_pre_order() { - AVLnode* current = root; - preOrder(current); - cout << endl; -} -template -void AVL::remove(const Key &key) { - root = deleteNode(root,key); -} -template -Value AVL::get(const Key &key) { - AVLnode* current = root; - return Find(key,current)->val; -} -template -bool AVL::has(const Key &key) { - AVLnode* current=root; - if(Find(key,current)->key==key) - return true; - else - return false; -} -template -Key AVL::successor(const Key &key) { - AVLnode* current = root; - AVLnode* suc = nullptr; - inOrderSuccessor(current,suc,key); - return suc->key; -} -template -Key AVL::predecessor(const Key &key) { - AVLnode* current = root; - AVLnode* pre = nullptr; - inOrderPredecesor(current,pre,key); - return pre->key; -} -template -Key AVL::minimum() { - return minValueNode(root)->key; -} -template -Key AVL::maximum() { - return maxValueNode(root)->key; -} -template -void AVL::print_in_order() { - inOrder(root); -} -template -void AVL::print_post_order() { - postOrder(root); -} -template -int AVL::getHeight() { - return root->height; -} -template -void AVL::print() { - inOrder(root); -} -template -int AVL::size() { - return count(root); -} -template -void q1(AVLnode* root, Key k1, Key k2, Value val, Value& count) { - if(root == nullptr) - return; - if(k1 < root->key) - q1(root->left,k1,k2,val,count); - if(k1 < root->key && k2 >= root->key) { - if(abs(root->val-val)val-val); - } - - if(k2 > root->key) - q1(root->right,k1,k2,val,count); -} -template -Value AVL::que_1(Key &key, Value &val) { - Value count = INT32_MAX; - AVLnode* current = root; - Key max = maximum(); - q1(current,key,max,val,count); - if(count == INT32_MAX) - return -1; - else - return count; -} -template -void q2(AVLnode* root, Key k1, Key k2, Value val, Value& count) { - if(root == nullptr) - return; - if(k1 < root->key) - q2(root->left,k1,k2,val,count); - if(k1 <= root->key && k2 > root->key) { -// cout << root->key << " " << root->val << " "; - if(root->val>val) { - count++; - } - } - - if(k2 > root->key) - q2(root->right,k1,k2,val,count); -} -template -Value AVL::que_2(Key &key, Value &val) { - Value count = 0; - AVLnode *current = root; - Key min = minimum(); - q2(current,min,key,val,count); - return count; -} +// C program to insert a node in AVL tree +#include +#include + +// An AVL tree node +struct Node +{ + int key; + struct Node *left; + struct Node *right; + int height; +}; + +// A utility function to get maximum of two integers +int max(int a, int b); + +// A utility function to get the height of the tree +int height(struct Node *N) +{ + if (N == NULL) + return 0; + return N->height; +} + +// A utility function to get maximum of two integers +int max(int a, int b) +{ + return (a > b)? a : b; +} + +/* Helper function that allocates a new node with the given key and + NULL left and right pointers. */ +struct Node* newNode(int key) +{ + struct Node* node = (struct Node*) + malloc(sizeof(struct Node)); + node->key = key; + node->left = NULL; + node->right = NULL; + node->height = 1; // new node is initially added at leaf + return(node); +} + +struct Node *rightRotate(struct Node *y) +{ + struct Node *x = y->left; + struct Node *T2 = x->right; + + // Perform rotation + x->right = y; + y->left = T2; + + // Update heights + y->height = max(height(y->left), height(y->right))+1; + x->height = max(height(x->left), height(x->right))+1; + + // Return new root + return x; +} + +// A utility function to left rotate subtree rooted with x +// See the diagram given above. +struct Node *leftRotate(struct Node *x) +{ + struct Node *y = x->right; + struct Node *T2 = y->left; + + // Perform rotation + y->left = x; + x->right = T2; + + // Update heights + x->height = max(height(x->left), height(x->right))+1; + y->height = max(height(y->left), height(y->right))+1; + + // Return new root + return y; +} + +// Get Balance factor of node N +int getBalance(struct Node *N) +{ + if (N == NULL) + return 0; + return height(N->left) - height(N->right); +} + + +struct Node* insert(struct Node* node, int key) +{ + /* 1. Perform the normal BST insertion */ + if (node == NULL) + return(newNode(key)); + + if (key < node->key) + node->left = insert(node->left, key); + else if (key > node->key) + node->right = insert(node->right, key); + else // Equal keys are not allowed in BST + return node; + + /* 2. Update height of this ancestor node */ + node->height = 1 + max(height(node->left), + height(node->right)); + + /* 3. Get the balance factor of this ancestor + node to check whether this node became + unbalanced */ + int balance = getBalance(node); + + // If this node becomes unbalanced, then + // there are 4 cases + + // Left Left Case + if (balance > 1 && key < node->left->key) + return rightRotate(node); + + // Right Right Case + if (balance < -1 && key > node->right->key) + return leftRotate(node); + + // Left Right Case + if (balance > 1 && key > node->left->key) + { + node->left = leftRotate(node->left); + return rightRotate(node); + } + + // Right Left Case + if (balance < -1 && key < node->right->key) + { + node->right = rightRotate(node->right); + return leftRotate(node); + } + + /* return the (unchanged) node pointer */ + return node; +} + +// A utility function to print preorder traversal +// of the tree. +// The function also prints height of every node +void preOrder(struct Node *root) +{ + if(root != NULL) + { + printf("%d ", root->key); + preOrder(root->left); + preOrder(root->right); + } +} From 60f2a56236df777acbfa5b00c1c9434be96535b9 Mon Sep 17 00:00:00 2001 From: eashsaxena <44508862+eashsaxena@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:44:06 +0530 Subject: [PATCH 058/333] added code in c --- Sorting/Merge Sort/C++/merge_sort.cpp | 166 +++++++++++++------------- 1 file changed, 86 insertions(+), 80 deletions(-) diff --git a/Sorting/Merge Sort/C++/merge_sort.cpp b/Sorting/Merge Sort/C++/merge_sort.cpp index 919e95820..8f6a136e5 100644 --- a/Sorting/Merge Sort/C++/merge_sort.cpp +++ b/Sorting/Merge Sort/C++/merge_sort.cpp @@ -1,80 +1,86 @@ -/*Program for merge sort implementation in C++. */ - -#include -#include - -void mergeHalves(std::vector &A, int leftStart, int mid, int rightEnd) -{ - int n1=mid-leftStart+1, n2=rightEnd-mid; - std::vector left, right; - for (int i = 0; i < n1; i++) - { - left.push_back(A[leftStart+i]); - } - for (int i = 0; i < n2; i++) - { - right.push_back(A[mid+1+i]); - } - - int i=0, k=leftStart, j=0; - - while (i < n1 && j &A, int leftStart, int rightEnd) - -{/* - std::cout<<"Current list : \n"; - for(int i=0;i=rightEnd) - return; - - int mid = (leftStart+rightEnd)/2; - merge_sort(A,leftStart,mid); - merge_sort(A,mid+1,rightEnd); - - mergeHalves(A, leftStart, mid, rightEnd); -/* - std::cout<<"\nSorted list : \n"; - for(int i=0;i arr={10,2,23,-4,235,56,2,6,5,81,5,23,-4,346,-56,-54}; - - merge_sort(arr,0,arr.size()-1); - std::cout<<"\n\n\n"; - - for(int i=0;i +#include + +// Merges two subarrays of arr[]. +// First subarray is arr[l..m] +// Second subarray is arr[m+1..r] +void merge(int arr[], int l, int m, int r) +{ + int i, j, k; + int n1 = m - l + 1; + int n2 = r - m; + + /* create temp arrays */ + int L[n1], R[n2]; + + /* Copy data to temp arrays L[] and R[] */ + for (i = 0; i < n1; i++) + L[i] = arr[l + i]; + for (j = 0; j < n2; j++) + R[j] = arr[m + 1+ j]; + + /* Merge the temp arrays back into arr[l..r]*/ + i = 0; // Initial index of first subarray + j = 0; // Initial index of second subarray + k = l; // Initial index of merged subarray + while (i < n1 && j < n2) + { + if (L[i] <= R[j]) + { + arr[k] = L[i]; + i++; + } + else + { + arr[k] = R[j]; + j++; + } + k++; + } + + /* Copy the remaining elements of L[], if there + are any */ + while (i < n1) + { + arr[k] = L[i]; + i++; + k++; + } + + /* Copy the remaining elements of R[], if there + are any */ + while (j < n2) + { + arr[k] = R[j]; + j++; + k++; + } +} + +/* l is for left index and r is right index of the + sub-array of arr to be sorted */ +void mergeSort(int arr[], int l, int r) +{ + if (l < r) + { + // Same as (l+r)/2, but avoids overflow for + // large l and h + int m = l+(r-l)/2; + + // Sort first and second halves + mergeSort(arr, l, m); + mergeSort(arr, m+1, r); + + merge(arr, l, m, r); + } +} + +/* UTILITY FUNCTIONS */ +/* Function to print an array */ +void printArray(int A[], int size) +{ + int i; + for (i=0; i < size; i++) + printf("%d ", A[i]); + printf("\n"); +} From b25895ecbf6a15f44dd85f93db5d23d845971556 Mon Sep 17 00:00:00 2001 From: eashsaxena <44508862+eashsaxena@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:46:30 +0530 Subject: [PATCH 059/333] updated code --- .../BellmanFord-SingleSourceShortestPath.c | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/Dynamic Programming/BellmanFord-SingleSourceShortestPath.c b/Dynamic Programming/BellmanFord-SingleSourceShortestPath.c index 7ae62f11b..99946fca2 100644 --- a/Dynamic Programming/BellmanFord-SingleSourceShortestPath.c +++ b/Dynamic Programming/BellmanFord-SingleSourceShortestPath.c @@ -70,25 +70,4 @@ void printSolution(int dist[][V]) } } -// driver program to test above function -int main() -{ - /* Let us create the following weighted graph - 10 - (0)------->(3) - | /|\ - 5 | | - | | 1 - \|/ | - (1)------->(2) - 3 */ - int graph[V][V] = { {0, 5, INF, 10}, - {INF, 0, 3, INF}, - {INF, INF, 0, 1}, - {INF, INF, INF, 0} - }; - - // Print the solution - floydWarshall(graph); - return 0; -} + From f8683ea6cc3a5df5418221c64dbf51138bd1082e Mon Sep 17 00:00:00 2001 From: rubiotorres Date: Fri, 26 Oct 2018 17:16:56 -0200 Subject: [PATCH 060/333] added random.cpp --- Random Number/random.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Random Number/random.cpp diff --git a/Random Number/random.cpp b/Random Number/random.cpp new file mode 100644 index 000000000..0cb32d152 --- /dev/null +++ b/Random Number/random.cpp @@ -0,0 +1,13 @@ +#include +#include +#include + +int main (int argc, char const* argv[]) +{ + srand((unsigned)time(0)); + int maior = 100; + int menor = 30; + int aleatorio = rand()%(maior-menor+1) + menor; + std::cout << "Numero Aleatorio = " << aleatorio << std::endl; + return 0; +} From a8ac2b83b4d6d358d9176b7c070bf400b6bb82a1 Mon Sep 17 00:00:00 2001 From: eashsaxena <44508862+eashsaxena@users.noreply.github.com> Date: Sat, 27 Oct 2018 00:51:18 +0530 Subject: [PATCH 061/333] updated code --- Greedy Algorithms/minimum_number_of_coins.cpp | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Greedy Algorithms/minimum_number_of_coins.cpp b/Greedy Algorithms/minimum_number_of_coins.cpp index 5f534a52b..52fcb7843 100644 --- a/Greedy Algorithms/minimum_number_of_coins.cpp +++ b/Greedy Algorithms/minimum_number_of_coins.cpp @@ -1,27 +1,27 @@ -#include - using namespace std; - int deno[] = {1, 2, 5, 10, 20, 50, 100, 500, 1000}; //user defined denominations -int n = sizeof(deno)/sizeof(deno[0]); - void minChange(int m) -{ - vector v; - for (int i=n-1; i>=0; i--) - { - while (m>=deno[i]) - { - m-=deno[i]; - v.push_back(deno[i]); - } - } - for (int i = 0; i < v.size(); i++) - cout << v[i] << " "; -} - int main() -{ - int n; - cout<<"Enter a value n for which you want minimal number of change: "<<'\n'; - cin>>n; - cout << "Minimal number of change for " << n << " is "; - minChange(n); - return 0; -} +#include +using namespace std; + +// m is size of coins array (number of different coins) +int minCoins(int coins[], int m, int V) +{ + // base case + if (V == 0) return 0; + + // Initialize result + int res = INT_MAX; + + // Try every coin that has smaller value than V + for (int i=0; i Date: Sat, 27 Oct 2018 03:26:20 +0800 Subject: [PATCH 062/333] Create BubbleSortDinamis.java --- .../Bubble Sort/Java/BubbleSortDinamis.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Sorting/Bubble Sort/Java/BubbleSortDinamis.java diff --git a/Sorting/Bubble Sort/Java/BubbleSortDinamis.java b/Sorting/Bubble Sort/Java/BubbleSortDinamis.java new file mode 100644 index 000000000..6e4736022 --- /dev/null +++ b/Sorting/Bubble Sort/Java/BubbleSortDinamis.java @@ -0,0 +1,37 @@ +#Blazing21 +#Indonesia + +import java.util.Arrays; +import java.util.Scanner; + +public class BubbleSort { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int a; + System.out.print( "Range data : "); + a=scan.nextInt(); + int[] data = new int[a]; + for( int i = 0; i < data.length; i++ ){ + System.out.print("data-" + i + ": "); + data[i] = scan.nextInt(); + } + System.out.println("Before Sort: " + Arrays.toString(data)); + data = sort(data); + System.out.println("After Sort: " + Arrays.toString(data)); + } + + // bubble sort algorithm + public static int[] sort(int[] data) { + for (int i = 0; i < data.length; i++) { + for (int j = 0; j < data.length - 1; j++) { + if (data[j] > data[j + 1]) { + int temp = data[j]; + data[j] = data[j + 1]; + data[j + 1] = temp; + } + } + } + + return data; + } +} From 10781bb81a796f09c1a66c532d866cf001bf91a0 Mon Sep 17 00:00:00 2001 From: Febry Dwi Fitrianto <44501367+Blazing21@users.noreply.github.com> Date: Sat, 27 Oct 2018 03:34:01 +0800 Subject: [PATCH 063/333] Create BubbleSortDynamic.java --- .../Bubble Sort/Java/BubbleSortDynamic.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Sorting/Bubble Sort/Java/BubbleSortDynamic.java diff --git a/Sorting/Bubble Sort/Java/BubbleSortDynamic.java b/Sorting/Bubble Sort/Java/BubbleSortDynamic.java new file mode 100644 index 000000000..6e4736022 --- /dev/null +++ b/Sorting/Bubble Sort/Java/BubbleSortDynamic.java @@ -0,0 +1,37 @@ +#Blazing21 +#Indonesia + +import java.util.Arrays; +import java.util.Scanner; + +public class BubbleSort { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int a; + System.out.print( "Range data : "); + a=scan.nextInt(); + int[] data = new int[a]; + for( int i = 0; i < data.length; i++ ){ + System.out.print("data-" + i + ": "); + data[i] = scan.nextInt(); + } + System.out.println("Before Sort: " + Arrays.toString(data)); + data = sort(data); + System.out.println("After Sort: " + Arrays.toString(data)); + } + + // bubble sort algorithm + public static int[] sort(int[] data) { + for (int i = 0; i < data.length; i++) { + for (int j = 0; j < data.length - 1; j++) { + if (data[j] > data[j + 1]) { + int temp = data[j]; + data[j] = data[j + 1]; + data[j + 1] = temp; + } + } + } + + return data; + } +} From 85cb36da06386c58eae1583bed0481ca9f3ae394 Mon Sep 17 00:00:00 2001 From: some1specialnew <44509971+some1specialnew@users.noreply.github.com> Date: Sat, 27 Oct 2018 01:15:54 +0530 Subject: [PATCH 064/333] Create Diameter of Tree C++ code to find Create Diameter of Tree --- Graphs/Diameter_of_tree/Diameter_of_tree.cpp | 85 ++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Graphs/Diameter_of_tree/Diameter_of_tree.cpp diff --git a/Graphs/Diameter_of_tree/Diameter_of_tree.cpp b/Graphs/Diameter_of_tree/Diameter_of_tree.cpp new file mode 100644 index 000000000..26656db08 --- /dev/null +++ b/Graphs/Diameter_of_tree/Diameter_of_tree.cpp @@ -0,0 +1,85 @@ +#include +using namespace std; + +#define INF 0x3f3f3f3f +#define MOD 1000000007 + +#define ll long long +#define pb push_back +#define nl printf("\n"); +#define vint vector + +vector>g[100005]; +int n; +int dist[100005]; +void shortest_path(int s) +{ + for(int i=0;i<100001;i++) + dist[i]=INF; + set> setds; + + setds.insert({0,s}); + dist[s]=0; + while(!setds.empty()) + { + pair temp; + temp=*(setds.begin()); + setds.erase(setds.begin()); + + int u=temp.second; + vector>::iterator it; + for(it=g[u].begin();it!=g[u].end();it++) + { + int v = (*it).first; + int weight = (*it).second; + if(dist[v] > dist[u] + weight) + { + if(dist[v] != INF) + setds.erase(setds.find({dist[v],v})); + + dist[v]=dist[u] + weight; + setds.insert({dist[v],v}); + } + } + } + + // printf("Vertex Distance from Source\n"); + // for (int i = 0; i <= n ; ++i) + // printf("%d \t\t %d\n", i, dist[i]); + +} + +int main() +{ + ifstream myFile("task.in"); + if(!myFile.fail()) + { + assert(freopen("task.in", "r", stdin)); + } + int m; + cin>>n>>m; + n--; //starting from 0 + int total=0; + for(int i=0;i>x>>y>>w; + g[x].pb({y,w}); + g[y].pb({x,w}); + total+=w; + } + shortest_path(0); + int ma=0,ind; + for(int i=0;i ma) + ind=i,ma=dist[i]; + for(int i=0;100001;i++) + dist[i]=INF; + shortest_path(ind); + for(int i=0;i ma) + ind=i,ma=dist[i]; + cout<<(total - dist[ind]); + nl + return 0; +} From 84fd29ab9c899a823f62dbbe2ef67bac2a5440a2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Oct 2018 00:05:16 +0300 Subject: [PATCH 065/333] Added python implemenation for trailing zeros in a factorial number --- .../trailing_zeros_in_factorial/trailing_zeros.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Mathematics/trailing_zeros_in_factorial/trailing_zeros.py diff --git a/Mathematics/trailing_zeros_in_factorial/trailing_zeros.py b/Mathematics/trailing_zeros_in_factorial/trailing_zeros.py new file mode 100644 index 000000000..a27c724b9 --- /dev/null +++ b/Mathematics/trailing_zeros_in_factorial/trailing_zeros.py @@ -0,0 +1,14 @@ +def main(): + zeros = 0 + power_of_five = 5 + x = int(input("Number: ")) + + while power_of_five < x: + zeros += x // power_of_five + power_of_five *= 5 + print("Number of zeros: " + str(zeros)) + + +if __name__ == '__main__': + main() + From 23b80a5879e7dbfbb072ee5407db3dc88b61bcfd Mon Sep 17 00:00:00 2001 From: Anish110910 Date: Sat, 27 Oct 2018 02:54:08 +0530 Subject: [PATCH 066/333] Added A* pathfinding algorithm inside Graphs folder --- Graphs/A star pathfinding algorithm/Astar.py | 130 +++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Graphs/A star pathfinding algorithm/Astar.py diff --git a/Graphs/A star pathfinding algorithm/Astar.py b/Graphs/A star pathfinding algorithm/Astar.py new file mode 100644 index 000000000..ee15064ee --- /dev/null +++ b/Graphs/A star pathfinding algorithm/Astar.py @@ -0,0 +1,130 @@ +#In computer science, A* (pronounced as "A star") is a computer algorithm that is widely used in pathfinding and graph +# traversal, which is the process of finding a path between multiple points, called "nodes". It enjoys widespread use due +#to its performance and accuracy. However, in practical travel-routing systems, it is generally outperformed by algorithms +# which can pre-process the graph to attain better performance, although other work has found A* to be superior to other +#approaches. + +#This algorithm is widely used in the field game development to approximate the shortest path on a map +#It is similar to Dijkstra’s Algorithm in the sense that the main objective of both algorithms is to find the shortest path +# but it runs much quicker than Dijkstra’s Algorithm + +class Node(): + """A node class for A* Pathfinding""" + + def __init__(self, parent=None, position=None): + self.parent = parent + self.position = position + + self.g = 0 + self.h = 0 + self.f = 0 + + def __eq__(self, other): + return self.position == other.position + + +def astar(maze, start, end): + """Returns a list of tuples as a path from the given start to the given end in the given maze""" + + # Create start and end node + start_node = Node(None, start) + start_node.g = start_node.h = start_node.f = 0 + end_node = Node(None, end) + end_node.g = end_node.h = end_node.f = 0 + + # Initialize both open and closed list + open_list = [] + closed_list = [] + + # Add the start node + open_list.append(start_node) + + # Loop until you find the end + while len(open_list) > 0: + + # Get the current node + current_node = open_list[0] + current_index = 0 + for index, item in enumerate(open_list): + if item.f < current_node.f: + current_node = item + current_index = index + + # Pop current off open list, add to closed list + open_list.pop(current_index) + closed_list.append(current_node) + + # Found the goal + if current_node == end_node: + path = [] + current = current_node + while current is not None: + path.append(current.position) + current = current.parent + return path[::-1] # Return reversed path + + # Generate children + children = [] + for new_position in [(0, -1), (0, 1), (-1, 0), (1, 0), (-1, -1), (-1, 1), (1, -1), (1, 1)]: # Adjacent squares + + # Get node position + node_position = (current_node.position[0] + new_position[0], current_node.position[1] + new_position[1]) + + # Make sure within range + if node_position[0] > (len(maze) - 1) or node_position[0] < 0 or node_position[1] > (len(maze[len(maze)-1]) -1) or node_position[1] < 0: + continue + + # Make sure walkable terrain + if maze[node_position[0]][node_position[1]] != 0: + continue + + # Create new node + new_node = Node(current_node, node_position) + + # Append + children.append(new_node) + + # Loop through children + for child in children: + + # Child is on the closed list + for closed_child in closed_list: + if child == closed_child: + continue + + # Create the f, g, and h values + child.g = current_node.g + 1 + child.h = ((child.position[0] - end_node.position[0]) ** 2) + ((child.position[1] - end_node.position[1]) ** 2) + child.f = child.g + child.h + + # Child is already in the open list + for open_node in open_list: + if child == open_node and child.g > open_node.g: + continue + + # Add the child to the open list + open_list.append(child) + + +def main(): + + maze = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] + + start = (0, 0) + end = (7, 6) + + path = astar(maze, start, end) + print(path) + + +if __name__ == '__main__': +main() \ No newline at end of file From 0c40470f891f2101d1ca5006c6774f50ffadcad8 Mon Sep 17 00:00:00 2001 From: Daniel Perez Jensen Date: Fri, 26 Oct 2018 23:28:50 +0200 Subject: [PATCH 067/333] Added minimax algorithm that plays tic-tac-toe perfectly --- .../minimax/tic-tac-toe/tictactoe.py | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 Recursive Algorithms/minimax/tic-tac-toe/tictactoe.py diff --git a/Recursive Algorithms/minimax/tic-tac-toe/tictactoe.py b/Recursive Algorithms/minimax/tic-tac-toe/tictactoe.py new file mode 100644 index 000000000..b694ca5aa --- /dev/null +++ b/Recursive Algorithms/minimax/tic-tac-toe/tictactoe.py @@ -0,0 +1,210 @@ +import time +import random + + +class TicTacToe(): + '''Class that has all necesarry components for a tic tac toe game''' + def __init__(self, player1, player2): + self.board = [[None, None, None], + [None, None, None], + [None, None, None]] + self.current_player = player1.player_mark + self.player1 = player1 + self.player2 = player2 + + def render(self): + '''Renders the current board state''' + for row in self.board: + print("|", end="") + for item in row: + if item is None: + print(".", end="|") + else: + print(item, end="|") + print() + + def possible_moves(self): + '''Finds all possible_moves of current board state''' + moves = [] + for x in range(len(self.board)): + for y in range(len(self.board[x])): + if self.board[x][y] is None: + moves.append((x, y)) + + return moves + + def legal_move(self, move): + '''Determines if given move is legal''' + legal_moves = self.possible_moves() + if move in legal_moves: + return True + return False + + def move(self, move): + '''Moves a piece and switches current_player''' + if self.legal_move(move): + move_x = move[0] + move_y = move[1] + self.board[move_x][move_y] = self.current_player + self.last_move = move + self.switch() + return True + else: + return False + + def switch(self): + '''Switches current player''' + if self.current_player == "x": + self.current_player = "o" + else: + self.current_player = "x" + + def game_over(self): + '''Finds if current board_state is full and the game is over''' + if self.game_won(): + return True + for row in self.board: + for item in row: + if item is None: + return False + return True + + def game_won(self): + '''Finds if game is won and updates self.winning_player''' + board = self.board + for x in range(len(self.board)): + for y in range(len(self.board[x])): + mark = self.board[x][y] + if board[x][y] is not None: + if board[0][y] == board[1][y] == board[2][y]: + self.winning_player = mark + return True + if board[x][0] == board[x][1] == board[x][2]: + self.winning_player = mark + return True + if x == y and board[0][0] == board[1][1] == board[2][2]: + self.winning_player = mark + return True + if x + y == 2: + if board[0][2] == board[1][1] == board[2][0]: + self.winning_player = mark + return True + return False + + def revert_move(self, move): + x = move[0] + y = move[1] + self.switch() + self.board[x][y] = None + + def play(self): + + while not self.game_over(): + player_1_move = self.player1.best_move(self) + time.sleep(1) + self.move(player_1_move) + self.render() + print() + + if self.game_over(): + if self.game_won(): + print(self.winning_player, "has won!") + exit(0) + print("Nobody has won") + exit(0) + + player_2_move = self.player2.best_move(self) + time.sleep(1) + self.move(player_2_move) + self.render() + print() + + if self.game_won(): + print(self.winning_player, "has won!") + exit(0) + else: + print("Nobody has won.") + + +class MiniMaxPlayer(): + '''A perfect player that uses minimax to determine best move''' + def __init__(self, player): + self.player_mark = player + + def score(self, game, depth): + '''returns score of given board''' + if game.game_won(): + if game.winning_player is self.player_mark: + return 10 - depth + else: + return depth - 10 + return 0 + + def minimax(self, game, depth): + '''Minimax solution to selecting what to play''' + if game.game_over(): + return self.score(game, depth) + + depth += 1 + + scores = [] + moves = [] + # Recursively adds all scores of every possible move of a given state + for move in game.possible_moves(): + game.move(move) + scores.append(self.minimax(game, depth)) + game.revert_move(move) + moves.append(move) + + self.scores = scores + self.moves = moves + + # max solution in case current player is this player + if game.current_player is self.player_mark: + max_score_idx = scores.index(max(scores)) + highest_score = scores[max_score_idx] + # finds all moves with same value and selects one at random so + # every game doesn't play out the same + best_moves = [] + for i, move in enumerate(moves): + if scores[i] == highest_score: + best_moves.append(move) + self.choice = (random.choice(best_moves)) + return scores[max_score_idx] + + # min solution in case current player is opponent + else: + min_score_idx = scores.index(min(scores)) + self.choice = moves[min_score_idx] + return scores[min_score_idx] + + def best_move(self, game): + '''returns best move calculated with mini-max''' + self.minimax(game, 0) + return self.choice + + +class HumanPlayer(): + def __init__(self, player): + self.player_mark = player + + def best_move(self, game): + possible_moves = game.possible_moves() + x = None + y = None + while True: + x = int(input("What row do you want to mark?: ")) - 1 + y = int(input("What column do you want to mark?: ")) - 1 + if (x, y) in possible_moves: + break + else: + print("That position has already been marked") + return (x, y) + + +# player1 starts, indepent of marks. +player1 = HumanPlayer("x") +player2 = MiniMaxPlayer("o") + +game = TicTacToe(player1, player2) +game.play() \ No newline at end of file From 3750db0b09c894468c9a2fd41904484b9caa6e31 Mon Sep 17 00:00:00 2001 From: Anish110910 Date: Sat, 27 Oct 2018 03:04:07 +0530 Subject: [PATCH 068/333] Added First come first serve non-preemptive scheduling algorithm --- fcfs.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 fcfs.cpp diff --git a/fcfs.cpp b/fcfs.cpp new file mode 100644 index 000000000..e69de29bb From ad98d62b7bc877f3f2a3218d7f97aece7836a708 Mon Sep 17 00:00:00 2001 From: JayRaj Makhar Date: Sat, 27 Oct 2018 03:11:34 +0530 Subject: [PATCH 069/333] C++ Code for Dijkstra Shortest Path Algo --- .../dijkstra-shortest-path.cpp | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Greedy Algorithms/Dijkstra Shortest Path/dijkstra-shortest-path.cpp diff --git a/Greedy Algorithms/Dijkstra Shortest Path/dijkstra-shortest-path.cpp b/Greedy Algorithms/Dijkstra Shortest Path/dijkstra-shortest-path.cpp new file mode 100644 index 000000000..160c68805 --- /dev/null +++ b/Greedy Algorithms/Dijkstra Shortest Path/dijkstra-shortest-path.cpp @@ -0,0 +1,73 @@ +#include +#include +#include +#include +#include +#include +using namespace std; + +typedef pair ii; +typedef vector vi; +typedef vector vii; + +using namespace std; + +int n, m, S, T, w; + +vector AdjList; +vi dist; +priority_queue, greater> pq; + +void dijkstra(int s) +{ + + dist.assign(n, 1e9); + dist[s] = 0; + + pq.push(ii(0, s)); + + while (!pq.empty()) + { + ii front = pq.top(); pq.pop(); + int d = front.first, u = front.second; + if (d > dist[u]) + continue; + for (int j = 0; j < (int)AdjList[u].size(); j++) + { + ii v = AdjList[u][j]; + if (dist[u] + v.second < dist[v.first]) + { + dist[v.first] = dist[u] + v.second; + pq.push(ii(dist[v.first], v.first)); + } + } + } + + if (dist[T] == 1e9) + cout << "unreachable" << endl; + else + cout << dist[T] << endl; +} + +int main() +{ + int numCases; + cin >> numCases; + while (numCases--) + { + scanf("%d %d %d %d", &n, &m, &S, &T); + + AdjList.assign(n, vii()); + + int n1, n2; + for (int i = 0; i < m; i++) + { + scanf("%d %d %d", &n1, &n2, &w); + AdjList[n1].push_back(ii(n2, w)); + AdjList[n2].push_back(ii(n1, w)); + } + dijkstra(S); + } + + return 0; +} From f39cd7c750cd847d6a3ccfb5e38821a6b7d23655 Mon Sep 17 00:00:00 2001 From: atum Date: Fri, 26 Oct 2018 18:46:17 -0300 Subject: [PATCH 070/333] BOGOSORTS --- Sorting/Bogosort/C++/Bogosort.cpp | 17 +++++++++ Sorting/Bogosort/C/Bogosort.c | 37 +++++++++++++++++++ Sorting/Bogosort/Pascal/Bogosort.pas | 54 ++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 Sorting/Bogosort/C++/Bogosort.cpp create mode 100644 Sorting/Bogosort/C/Bogosort.c create mode 100644 Sorting/Bogosort/Pascal/Bogosort.pas diff --git a/Sorting/Bogosort/C++/Bogosort.cpp b/Sorting/Bogosort/C++/Bogosort.cpp new file mode 100644 index 000000000..89c86cf11 --- /dev/null +++ b/Sorting/Bogosort/C++/Bogosort.cpp @@ -0,0 +1,17 @@ + #include + #include + + template + void bogosort(std::vector& array) + { + while (! is_sorted(array)) + std::random_shuffle(array.begin(), array.end()); + } + + template + bool is_sorted(const std::vector& array) + { + for (typename std::vector::size_type i = 1; i < array.size(); ++i) + if (array[i] < array[i-1]) return false; + return true; + } \ No newline at end of file diff --git a/Sorting/Bogosort/C/Bogosort.c b/Sorting/Bogosort/C/Bogosort.c new file mode 100644 index 000000000..6416e0176 --- /dev/null +++ b/Sorting/Bogosort/C/Bogosort.c @@ -0,0 +1,37 @@ +#include +#include +#include + +bool is_sorted(int *a, int n) +{ + while ( --n >= 1 ) { + if ( a[n] < a[n-1] ) return false; + } + return true; +} + +void shuffle(int *a, int n) +{ + int i, t, r; + for(i=0; i < n; i++) { + t = a[i]; + r = rand() % n; + a[i] = a[r]; + a[r] = t; + } +} + +void bogosort(int *a, int n) +{ + while ( !is_sorted(a, n) ) shuffle(a, n); +} + +int main() +{ + int numbers[] = { 1, 10, 9, 7, 3, 0 }; + int i; + + bogosort(numbers, 6); + for (i=0; i < 6; i++) printf("%d ", numbers[i]); + printf("\n"); +} \ No newline at end of file diff --git a/Sorting/Bogosort/Pascal/Bogosort.pas b/Sorting/Bogosort/Pascal/Bogosort.pas new file mode 100644 index 000000000..9e0313082 --- /dev/null +++ b/Sorting/Bogosort/Pascal/Bogosort.pas @@ -0,0 +1,54 @@ + program bogosort (input, output); + const max=10; {*Tamanho do vetor *} + type vetor=array[1..max] of integer; + var lista, lista1: vetor; + i: integer; + j: boolean; + pos: integer; + + function teste(var proto: vetor): boolean; {*Verifica se o vetor NÃO está ordenado.*} + var i: integer; + begin + teste:=true; + for i:=2 to max do + if (proto[i]=proto[max-1]) then + teste:=false; + end; + + begin + randomize; {*Inicializa o gerador de numeros aleatórios *} + writeln('Escreva abaixo os ', max,' elementos do vetor:'); + for i:=1 to max do + begin + read(lista[i]); + lista1[i]:=lista[i]; + end; + for i:=1 to max do {*Escreve o vetor recebido *} + write(lista1[i],' '); + writeln; + while teste(lista1) do {*Enquanto o vetor nao esta ordenado...*} + begin + j:=true; + for i:=1 to max do {*Inicializa o vetor auxiliar *} + lista1[i]:=0; + for i:=1 to max do {* Este loop preenche aleatoriamente o vetor auxiliar *} + begin + j:=true; + while j do {* Este while garante que nenhum dado será sobrescrito *} + begin + pos:= random(max)+1; {* Gera posição aleatória *} + if lista1[pos]=0 then {*Garante que a posição não está ocupada *} + begin + lista1[pos]:=lista[i]; + j:=false; + end; + end; + end; + for i:=1 to max do {* Imprime na tela a tentativa *} + write(lista1[i],' '); + writeln; + end; + write('A LISTA FOI ORDENADA!'); + end. \ No newline at end of file From c580fe7a8e33483fa995dd926c7507931a16f430 Mon Sep 17 00:00:00 2001 From: alk211001 <44242238+alk211001@users.noreply.github.com> Date: Sat, 27 Oct 2018 01:27:49 +0300 Subject: [PATCH 071/333] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94a031855..00fe59f55 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Clean example implementations of data structures and algorithms written in diffe [![Gitter chat](https://badges.gitter.im/VAR-solutions/Algorithms.png)](https://gitter.im/VAR-solutions/Algorithms "Gitter chat") [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) [![Issues](http://img.shields.io/github/issues/VAR-solutions/Algorithms.svg)](https://github.com/VAR-solutions/Algorithms/issues) -## List of implementations +#### List of implementations [Algorithms list(not updated)](#) From 53fac335682c1e4f059afcac462790d004612009 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Oct 2018 01:36:21 +0300 Subject: [PATCH 072/333] Added C implementation for bogosort --- Sorting/Bogosort/C/bogosort.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Sorting/Bogosort/C/bogosort.c diff --git a/Sorting/Bogosort/C/bogosort.c b/Sorting/Bogosort/C/bogosort.c new file mode 100644 index 000000000..c07d1b973 --- /dev/null +++ b/Sorting/Bogosort/C/bogosort.c @@ -0,0 +1,40 @@ +#include +#include +#include + +int isSorted(int *v, int size) +{ + int i; + for (i = 0; i < size - 1; i++) + if (v[i] > v[i+1]) + return 0; + return 1; +} + +void bogoSort(int *v, int size) +{ + int i, aux, r; + while (!isSorted(v, size)) + { + for (i = 0; i < size; i++) + { + r = rand() % size; + aux = v[i]; + v[i] = v[r]; + v[r] = aux; + } + } +} + +int main() +{ + srand(time(NULL)); + int v[8] = {5, 8, 2, 1, 6, 4, 3, 7}; + + bogoSort(v, 8); + int i; + for (i = 0; i < 8; i++) + printf("%d ", v[i]); + printf("\n"); + return 0; +} From 9b355b5f03c79611c56c956445fbe4bed5d576f4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Oct 2018 01:56:42 +0300 Subject: [PATCH 073/333] Added prime number checker in python3 --- Other Algorithms/isPrime.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Other Algorithms/isPrime.py diff --git a/Other Algorithms/isPrime.py b/Other Algorithms/isPrime.py new file mode 100644 index 000000000..8d688267b --- /dev/null +++ b/Other Algorithms/isPrime.py @@ -0,0 +1,18 @@ +def is_prime(x): + if x < 2: + return False + if x > 2 and x % 2 == 0: + return False + for i in range(3, int(x ** 0.5), 2): + if x % i == 0: + return False + return True + + +def main(): + x = int(input()) + print(str(x) + " is prime: " + str(is_prime(x))) + + +if __name__ == '__main__': + main() From 809bb97f7edc308bb529fb3ab57786f8d8374449 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Oct 2018 02:04:15 +0300 Subject: [PATCH 074/333] Added palindrome check in python3 --- Other Algorithms/isPalindrome.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Other Algorithms/isPalindrome.py diff --git a/Other Algorithms/isPalindrome.py b/Other Algorithms/isPalindrome.py new file mode 100644 index 000000000..9aab02f8f --- /dev/null +++ b/Other Algorithms/isPalindrome.py @@ -0,0 +1,14 @@ +def is_palindrome(x): + s = str(x) + if s == s[::-1]: + return True + return False + + +def main(): + x = int(input()) + print(str(x) + " is palindrome: " + str(is_palindrome(x))) + + +if __name__ == '__main__': + main() From eafd4fc7f5a5db8f8f14473e033150a85d8383ac Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Oct 2018 02:35:16 +0300 Subject: [PATCH 075/333] Added C implementation for the Karatsuba algorithm --- Mathematics/Karatsuba/C/karatsuba.c | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Mathematics/Karatsuba/C/karatsuba.c diff --git a/Mathematics/Karatsuba/C/karatsuba.c b/Mathematics/Karatsuba/C/karatsuba.c new file mode 100644 index 000000000..9d1682cc6 --- /dev/null +++ b/Mathematics/Karatsuba/C/karatsuba.c @@ -0,0 +1,49 @@ +#include +#include + +int size(int a) +{ + int size = 0; + while (a != 0) + { + a /= 10; + size++; + } + return size; +} + +int max(int a, int b) +{ + if (a > b) + return a; + else + return b; +} + +int karatsuba(int a, int b) +{ + if (a < 10 && b < 10) + return a * b; + + int m = max(size(a), size(b)); + int m2 = m/2; + + int high1 = a / ((int) pow(10, m2)); + int low1 = a % ((int) pow(10, m2)); + int high2 = b / ((int) pow(10, m2)); + int low2 = b % ((int) pow(10, m2)); + + int z0 = karatsuba(low1, low2); + int z1 = karatsuba((low1 + high1), (low2 + high2)); + int z2 = karatsuba(high1, high2); + + return (z2 * ((int)pow(10, (m2 * 2)))) + ((z1 - z2 - z0) * ((int)pow(10, m2))) + z0; +} + +int main() +{ + int a, b; + scanf ("%d %d", &a, &b); + printf("%d * %d = %d\n", a, b, karatsuba(a, b)); + return 0; +} From dd926d363019f77fc8dc3b75011441a3c86e40d5 Mon Sep 17 00:00:00 2001 From: Alex Franco <26696700+afranco20@users.noreply.github.com> Date: Fri, 26 Oct 2018 19:56:57 -0400 Subject: [PATCH 076/333] Add fsharp fibonacci code --- Mathematics/fibonacci/fsharp/fibonacci.fs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Mathematics/fibonacci/fsharp/fibonacci.fs diff --git a/Mathematics/fibonacci/fsharp/fibonacci.fs b/Mathematics/fibonacci/fsharp/fibonacci.fs new file mode 100644 index 000000000..e493fb575 --- /dev/null +++ b/Mathematics/fibonacci/fsharp/fibonacci.fs @@ -0,0 +1,7 @@ +let fib n = + let rec loop acc1 acc2 = function + | n when n = 0I -> acc1 + | n -> loop acc2 (acc1 + acc2) (n - 1I) + + loop 0I 1I n + From e31d47929b6e950a59563587873c850195ebf7b0 Mon Sep 17 00:00:00 2001 From: kinhosz <39632709+kinhosz@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:16:53 -0300 Subject: [PATCH 077/333] Create unlocked --- Outros Algoritmos/unlocked | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Outros Algoritmos/unlocked diff --git a/Outros Algoritmos/unlocked b/Outros Algoritmos/unlocked new file mode 100644 index 000000000..98c0595d0 --- /dev/null +++ b/Outros Algoritmos/unlocked @@ -0,0 +1,80 @@ +#include +using namespace std; + +const int INF = 10001; +string A,B; +int r; +int validade[10001]; +vector v; +int minimo; +int cost; + +void init(){ + + for(int i=0;i<10000;i++){ + validade[i] = 0; + } +} + +int main(){ + + int inicio,fim; + int z; + z = 1; + cin >> A >> B >> r; + while(A!="0" || B!="0" || r!=0){ + int base; + base = 1000; + inicio = 0; fim = 0; + for(int i=0;i<4;i++){ + inicio += base*(A[i] - 48); + fim += base*(B[i] - 48); + base /= 10; + } + v.clear(); + for(int i=0;i> A; + int base; + int value = 0; + base = 1000; + for(int j=0;j<4;j++){ + value += base*(A[j] - 48); + base /= 10; + } + v.push_back(value); + } + bool ans = false; + init(); + queue> q; + q.push({inicio,0}); + while(!q.empty()){ + pair g; + g = q.front(); q.pop(); + int u,x,point; + point = g.second; + u = g.first; + if(u == fim){ + ans = true; + minimo = point; + break; + } + point++; + for(int i=0;i> A >> B >> r; + } +} From 4d5912b11b9e74f3221361b98e9ceb4c75339f52 Mon Sep 17 00:00:00 2001 From: kinhosz <39632709+kinhosz@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:19:41 -0300 Subject: [PATCH 078/333] Create maskBits --- Outros Algoritmos/maskBits | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Outros Algoritmos/maskBits diff --git a/Outros Algoritmos/maskBits b/Outros Algoritmos/maskBits new file mode 100644 index 000000000..aba0f1709 --- /dev/null +++ b/Outros Algoritmos/maskBits @@ -0,0 +1,68 @@ +#include +using namespace std; + +const int lim = 1000000007; + +int dp[2050][105]; +int n; +vector> g; + +void init(){ + for(int i=0;i<2050;i++){ + for(int j=0;j<105;j++){ + dp[i][j] = -1; + } + } +} + +int busca(int mask,int camisa){ + + int size = __builtin_popcount(mask); + if(size == n){ + return 1; + } + if(camisa > 100){ + return 0; + } + if(dp[mask][camisa]!=-1){ + return dp[mask][camisa]; + } + int resp = 0; + for(int i=0;i Date: Fri, 26 Oct 2018 21:21:22 -0300 Subject: [PATCH 079/333] Create badXor --- Outros Algoritmos/badXor | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Outros Algoritmos/badXor diff --git a/Outros Algoritmos/badXor b/Outros Algoritmos/badXor new file mode 100644 index 000000000..5da18e3a9 --- /dev/null +++ b/Outros Algoritmos/badXor @@ -0,0 +1,55 @@ +#include +using namespace std; + +const int mod = 100000007; + +int main(){ + + vector A; + vector B; + int dp[1005][1024]; + + int tc; + int z = 1; + cin >> tc; + while(tc--){ + A.clear(); + B.clear(); + int n,m; + cin >> n >> m; + A.resize(n); B.resize(m); + for(int i=0;i> A[i]; + } + for(int i=0;i> B[i]; + } + sort(B.begin(),B.end()); + for(int i=0;i<=n;i++){ + for(int j=0;j<1024;j++){ + dp[i][j] = 0; + } + } + dp[0][0] = 1; + for(int i=1;i<=n;i++){ + int a = A[i-1]; + for(int j=0;j<1024;j++){ + dp[i][j] = (dp[i-1][j] + dp[i-1][j^a])%mod; + dp[i][j] %= mod; + } + } + B.push_back(1025); + int curr = 0; + int ans = 0; + for(int i=0;i<1024;i++){ + if(i == B[curr]){ + curr++; + } + else{ + ans += dp[n][i]; + ans %= mod; + } + } + cout << "Case " << z++ << ": " << ans << endl; + } +} From b3efda3dc7ad53ee77e15a8f5396ad8d5e7220a0 Mon Sep 17 00:00:00 2001 From: kinhosz <39632709+kinhosz@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:23:33 -0300 Subject: [PATCH 080/333] Create progCompetitiva --- Outros Algoritmos/progCompetitiva | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Outros Algoritmos/progCompetitiva diff --git a/Outros Algoritmos/progCompetitiva b/Outros Algoritmos/progCompetitiva new file mode 100644 index 000000000..ec20903d6 --- /dev/null +++ b/Outros Algoritmos/progCompetitiva @@ -0,0 +1,71 @@ +#include +using namespace std; +const int maxn = 1000; +int n; +int lista[maxn]; +int lista2[maxn]; +vector g; + +void base(){ + for(int i=0;i= g[b]) a++; + else b--; + soma1 += lista[a]; + a = inicio; b = fim; + soma2 = g[b]; b--; + if(g[a] >= g[b]) a++; + else b--; + soma2 += lista[a]; + lista2[k] = max(soma1,soma2); + k++; + inicio++; + fim++; + } + for(int i=0;i> n; + int z = 1; + int total; + int x1,x2; + while(n!=0){ + g.clear(); + total = 0; + for(int i=0;i> a; + total += a; + g.push_back(a); + } + base(); + x1 = dp(); + x2 = total - x1; + cout << "In game " << z++ << ", the greedy strategy might lose by as many as " << x1 - x2 << " points." << endl; + cin >> n; + } +} From 21d4b147697d3e078be4682b6ff537bad0021c91 Mon Sep 17 00:00:00 2001 From: kinhosz <39632709+kinhosz@users.noreply.github.com> Date: Fri, 26 Oct 2018 21:26:08 -0300 Subject: [PATCH 081/333] Create AVl-Tree --- Outros Algoritmos/AVl-Tree | 185 +++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 Outros Algoritmos/AVl-Tree diff --git a/Outros Algoritmos/AVl-Tree b/Outros Algoritmos/AVl-Tree new file mode 100644 index 000000000..b5d46082e --- /dev/null +++ b/Outros Algoritmos/AVl-Tree @@ -0,0 +1,185 @@ +#include +#include + +typedef struct nod{ + + int key; + int nodecountL; + int nodecountR; + int height; + struct nod *left; + struct nod *right; +}Node; + +typedef struct{ + + Node *root; +}BST; + +BST *create_bst(){ + + BST *bst; + + bst = (BST *) malloc(sizeof(BST)); + bst->root = NULL; + + return bst; +} + +int max(int a,int b){ + + if(a>b) return a; + else return b; +} + +int height(Node *node){ + + if(node==NULL) return -1; + else return node->height; +} + +int total(Node *node){ + + if(node==NULL) return 0; + else return (1+(node->nodecountL) + (node->nodecountR)); +} + +Node *leftRotate(Node *node){ + + Node *r,*rl; + + r = node->right; + rl = r->left; + r->left = node; + node->right = rl; + node->nodecountR = total(rl); + r->nodecountL = total(node); + node->height = max(height(node->left),height(node->right)) + 1; + r->height = max(height(r->left),height(r->right)) + 1; + + return r; +} + +Node *rightRotate(Node *node){ + + Node *l,*lr; + + l = node->left; + lr = l->right; + l->right = node; + node->left = lr; + node->nodecountL = total(lr); + l->nodecountR = total(node); + node->height = max(height(node->left),height(node->right)) + 1; + l->height = max(height(l->left),height(l->right)) + 1; + + return l; +} + +Node *inserthelp(Node *node,int x){ + + int balance; + if(node==NULL){ + node = (Node *) malloc(sizeof(Node)); + node->key = x; + node->nodecountL = 0; + node->nodecountR = 0; + node->height = 0; + node->left = NULL; + node->right = NULL; + return node; + } + if(x < node->key){ + node->left = inserthelp(node->left,x); + node->nodecountL++; + } + else{ + node->right = inserthelp(node->right,x); + node->nodecountR++; + } + node->height = max(height(node->left),height(node->right)) + 1; + balance = height(node->left) - height(node->right); + if(balance > 1 && x < (node->left->key)){ + node = rightRotate(node); + } + else if(balance < -1 && x > (node->right->key)){ + node = leftRotate(node); + } + else if(balance > 1 && x > (node->left->key)){ + node->left = leftRotate(node->left); + node = rightRotate(node); + } + else if(balance < -1 && x < (node->right->key)){ + node->right = rightRotate(node->right); + node = leftRotate(node); + } + + return node; + +} + +void insert(BST *bst,int x){ + + bst->root = inserthelp(bst->root,x); +} + +int findhelp(Node *node,int x,int value){ + + if(node==NULL) return -1; + if(node->key == x) return (value+(node->nodecountL)+1); + else if(x > node->key){ + value+= (total(node->left) + 1); + return findhelp(node->right,x,value); + } + else{ + return findhelp(node->left,x,value); + } +} + +int find(BST *bst,int x){ + + return findhelp(bst->root,x,0); +} + +Node *apagar(Node *node){ + + if(node==NULL) return NULL; + node->left = apagar(node->left); + node->right = apagar(node->right); + free(node); + return NULL; +} + +void clear(BST *bst){ + + bst->root = apagar(bst->root); +} + + +int main(){ + + BST *bst; + int q,op,x,i,st; + + bst = create_bst(); + scanf("%d",&q); + for(int i=0;i Date: Fri, 26 Oct 2018 22:00:36 -0300 Subject: [PATCH 082/333] Sending Suffix Automata --- Other Algorithms/Suffix Automaton/CPP/SA.cpp | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Other Algorithms/Suffix Automaton/CPP/SA.cpp diff --git a/Other Algorithms/Suffix Automaton/CPP/SA.cpp b/Other Algorithms/Suffix Automaton/CPP/SA.cpp new file mode 100644 index 000000000..d6a098ae4 --- /dev/null +++ b/Other Algorithms/Suffix Automaton/CPP/SA.cpp @@ -0,0 +1,48 @@ +#include +#define MAX 1000007 + +using namespace std; + +struct node{ + int link, len; + map next; +} st[MAX]; + +int sz, last; + +void init(){ + sz = 1; + last = 0; + st[0].len = 0; + st[0].link = -1; + st[0].next.clear(); +} + +void add(char c){ + int cur = sz++; + st[cur].len = st[last].len + 1; + + for(; last != -1 && !st[last].next[c]; last = st[last].link) st[last].next[c] = cur; + + if(last == -1) st[cur].link = 0; + else{ + int q = st[last].next[c]; + if(st[q].len == st[last].len + 1) st[cur].link = q; + else{ + int clone = sz++; + st[clone].len = st[last].len + 1; + st[clone].link = st[q].link; + st[clone].next = st[q].next; + + for(; last != -1 && st[last].next[c] == q; last = st[last].link) st[last].next[c] = clone; + st[q].link = st[cur].link = clone; + } + } + last = cur; +} +int main(){ + string palavra; cin >> palavra; + init(); + for(int i = 0; i < palavra.size(); i++) add(palavra[i]); + return 0; +} \ No newline at end of file From e649957d19e3ecb642e07295836997ac430ee5e0 Mon Sep 17 00:00:00 2001 From: Gabriel Teles Date: Fri, 26 Oct 2018 22:04:12 -0300 Subject: [PATCH 083/333] adding ruby bogosort --- Sorting/Bogosort/Ruby/bogosort.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sorting/Bogosort/Ruby/bogosort.rb diff --git a/Sorting/Bogosort/Ruby/bogosort.rb b/Sorting/Bogosort/Ruby/bogosort.rb new file mode 100644 index 000000000..27ed30df0 --- /dev/null +++ b/Sorting/Bogosort/Ruby/bogosort.rb @@ -0,0 +1,16 @@ +def sorted?(ary) + 0.upto(ary.size - 2).all? { |n| ary[n] <= ary[n + 1] } +end + +def bogosort(ary) + until sorted?(ary) + ary.shuffle! + end + + ary +end + +test_array = Array.new(10) { rand(100) } +bogosort(test_array) +puts "Sorted array: #{test_array}" +puts "Correct? #{test_array == test_array.sort}" \ No newline at end of file From 29f004112aae57dd80c7bec32e1136fdd227f607 Mon Sep 17 00:00:00 2001 From: Gabriel Teles Date: Fri, 26 Oct 2018 22:06:29 -0300 Subject: [PATCH 084/333] adding bogosort doc --- Sorting/Bogosort/Ruby/bogosort.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sorting/Bogosort/Ruby/bogosort.rb b/Sorting/Bogosort/Ruby/bogosort.rb index 27ed30df0..4875698a4 100644 --- a/Sorting/Bogosort/Ruby/bogosort.rb +++ b/Sorting/Bogosort/Ruby/bogosort.rb @@ -1,3 +1,8 @@ +# BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort +# or monkey sort is a particularly ineffective algorithm based on generate and +# test paradigm. The algorithm successively generates permutations of its input +# until it finds one that is sorted. + def sorted?(ary) 0.upto(ary.size - 2).all? { |n| ary[n] <= ary[n + 1] } end From 7f5288779ba3cf70435de2f650d8e89eef3ed75f Mon Sep 17 00:00:00 2001 From: Aidan Date: Fri, 26 Oct 2018 21:54:35 -0400 Subject: [PATCH 085/333] Create fibonacci.jl Implementation of Fibonacci Algorithm in Julia. --- Mathematics/fibonacci/Julia/fibonacci.jl | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Mathematics/fibonacci/Julia/fibonacci.jl diff --git a/Mathematics/fibonacci/Julia/fibonacci.jl b/Mathematics/fibonacci/Julia/fibonacci.jl new file mode 100644 index 000000000..df7e28194 --- /dev/null +++ b/Mathematics/fibonacci/Julia/fibonacci.jl @@ -0,0 +1,8 @@ +function fibonacci(x::Int) + if x <= 1 + return x + else + return fibonacci(x - 1) + fibonacci(x - 2) + end + return 0 +end From adc5f5085148708203e7d4fd5df132d8a0d2e73e Mon Sep 17 00:00:00 2001 From: JOSE THOMAS <34163586+josethomas98@users.noreply.github.com> Date: Sat, 27 Oct 2018 09:33:05 +0530 Subject: [PATCH 086/333] top view of a binary tree --- Tree/top view/topview.cpp.txt | 99 +++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Tree/top view/topview.cpp.txt diff --git a/Tree/top view/topview.cpp.txt b/Tree/top view/topview.cpp.txt new file mode 100644 index 000000000..2709837c2 --- /dev/null +++ b/Tree/top view/topview.cpp.txt @@ -0,0 +1,99 @@ + +// C++ program to print top +// view of binary tree + +#include +#include +#include +using namespace std; + +// Structure of binary tree +struct Node +{ + Node * left; + Node* right; + int hd; + int data; +}; + +// function to create a new node +Node* newNode(int key) +{ + Node* node=new Node(); + node->left = node->right = NULL; + node->data=key; + return node; +} + +// function should print the topView of +// the binary tree +void topview(Node* root) +{ + if(root==NULL) + return; + queueq; + map m; + int hd=0; + root->hd=hd; + + // push node and horizontal distance to queue + q.push(root); + + cout<< "The top view of the tree is : \n"; + + while(q.size()) + { + hd=root->hd; + + // count function returns 1 if the container + // contains an element whose key is equivalent + // to hd, or returns zero otherwise. + if(m.count(hd)==0) + m[hd]=root->data; + if(root->left) + { + root->left->hd=hd-1; + q.push(root->left); + } + if(root->right) + { + root->right->hd=hd+1; + q.push(root->right); + } + q.pop(); + root=q.front(); + + } + + + + for(auto i=m.begin();i!=m.end();i++) + { + cout<second<<" "; + } + +} + +// Driver Program to test above functions +int main() +{ + /* Create following Binary Tree + 1 + / \ + 2 3 + \ + 4 + \ + 5 + \ + 6*/ + Node* root = newNode(1); + root->left = newNode(2); + root->right = newNode(3); + root->left->right = newNode(4); + root->left->right->right = newNode(5); + root->left->right->right->right = newNode(6); + cout<<"Following are nodes in top view of Binary Tree\n"; + topview(root); + return 0; +} \ No newline at end of file From 825a4cfb4d7d067db615509e81e3e621174a5d41 Mon Sep 17 00:00:00 2001 From: Pallavi Bhandari <44194875+pallavibhandari4@users.noreply.github.com> Date: Sat, 27 Oct 2018 09:39:41 +0530 Subject: [PATCH 087/333] Create LinkedList.json --- LinkedList.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 LinkedList.json diff --git a/LinkedList.json b/LinkedList.json new file mode 100644 index 000000000..fb5ae28bc --- /dev/null +++ b/LinkedList.json @@ -0,0 +1,8 @@ +Inserting at end of linked list + +create newnode with vale newnode -> next as null +check if list is empty(head==null) +if empty, set head=newnode +if notempty then define a node pointer temp and initialize with head +keep moving temp until temp-> next is equal to null +set temp -> next=newnode From 078627a7e77d6a9c77f3cbee18cec283dbc0bc08 Mon Sep 17 00:00:00 2001 From: JOSE THOMAS <34163586+josethomas98@users.noreply.github.com> Date: Sat, 27 Oct 2018 09:47:11 +0530 Subject: [PATCH 088/333] manachers algorithm --- .../manachers algorithm/manacher algorithm.py | 89 +++++++++++++++++++ .../manacher algorithm.txt | 89 +++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 Other Algorithms/String/manachers algorithm/manacher algorithm.py create mode 100644 Other Algorithms/String/manachers algorithm/manacher algorithm.txt diff --git a/Other Algorithms/String/manachers algorithm/manacher algorithm.py b/Other Algorithms/String/manachers algorithm/manacher algorithm.py new file mode 100644 index 000000000..5905eb422 --- /dev/null +++ b/Other Algorithms/String/manachers algorithm/manacher algorithm.py @@ -0,0 +1,89 @@ +def findLongestPalindromicString(text): + N = len(text) + if N == 0: + return + N = 2*N+1 # Position count + L = [0] * N + L[0] = 0 + L[1] = 1 + C = 1 # centerPosition + R = 2 # centerRightPosition + i = 0 # currentRightPosition + iMirror = 0 # currentLeftPosition + maxLPSLength = 0 + maxLPSCenterPosition = 0 + start = -1 + end = -1 + diff = -1 + + # Uncomment it to print LPS Length array + # printf("%d %d ", L[0], L[1]); + for i in xrange(2,N): + + # get currentLeftPosition iMirror for currentRightPosition i + iMirror = 2*C-i + L[i] = 0 + diff = R - i + # If currentRightPosition i is within centerRightPosition R + if diff > 0: + L[i] = min(L[iMirror], diff) + + # Attempt to expand palindrome centered at currentRightPosition i + # Here for odd positions, we compare characters and + # if match then increment LPS Length by ONE + # If even position, we just increment LPS by ONE without + # any character comparison + try: + while ((i + L[i]) < N and (i - L[i]) > 0) and \ + (((i + L[i] + 1) % 2 == 0) or \ + (text[(i + L[i] + 1) / 2] == text[(i - L[i] - 1) / 2])): + L[i]+=1 + except Exception as e: + pass + + if L[i] > maxLPSLength: # Track maxLPSLength + maxLPSLength = L[i] + maxLPSCenterPosition = i + + # If palindrome centered at currentRightPosition i + # expand beyond centerRightPosition R, + # adjust centerPosition C based on expanded palindrome. + if i + L[i] > R: + C = i + R = i + L[i] + + # Uncomment it to print LPS Length array + # printf("%d ", L[i]); + start = (maxLPSCenterPosition - maxLPSLength) / 2 + end = start + maxLPSLength - 1 + print "LPS of string is " + text + " : ", + print text[start:end+1], + print "\n", + +# Driver program +text1 = "babcbabcbaccba" +findLongestPalindromicString(text1) + +text2 = "abaaba" +findLongestPalindromicString(text2) + +text3 = "abababa" +findLongestPalindromicString(text3) + +text4 = "abcbabcbabcba" +findLongestPalindromicString(text4) + +text5 = "forgeeksskeegfor" +findLongestPalindromicString(text5) + +text6 = "caba" +findLongestPalindromicString(text6) + +text7 = "abacdfgdcaba" +findLongestPalindromicString(text7) + +text8 = "abacdfgdcabba" +findLongestPalindromicString(text8) + +text9 = "abacdedcaba" +findLongestPalindromicString(text9) \ No newline at end of file diff --git a/Other Algorithms/String/manachers algorithm/manacher algorithm.txt b/Other Algorithms/String/manachers algorithm/manacher algorithm.txt new file mode 100644 index 000000000..5905eb422 --- /dev/null +++ b/Other Algorithms/String/manachers algorithm/manacher algorithm.txt @@ -0,0 +1,89 @@ +def findLongestPalindromicString(text): + N = len(text) + if N == 0: + return + N = 2*N+1 # Position count + L = [0] * N + L[0] = 0 + L[1] = 1 + C = 1 # centerPosition + R = 2 # centerRightPosition + i = 0 # currentRightPosition + iMirror = 0 # currentLeftPosition + maxLPSLength = 0 + maxLPSCenterPosition = 0 + start = -1 + end = -1 + diff = -1 + + # Uncomment it to print LPS Length array + # printf("%d %d ", L[0], L[1]); + for i in xrange(2,N): + + # get currentLeftPosition iMirror for currentRightPosition i + iMirror = 2*C-i + L[i] = 0 + diff = R - i + # If currentRightPosition i is within centerRightPosition R + if diff > 0: + L[i] = min(L[iMirror], diff) + + # Attempt to expand palindrome centered at currentRightPosition i + # Here for odd positions, we compare characters and + # if match then increment LPS Length by ONE + # If even position, we just increment LPS by ONE without + # any character comparison + try: + while ((i + L[i]) < N and (i - L[i]) > 0) and \ + (((i + L[i] + 1) % 2 == 0) or \ + (text[(i + L[i] + 1) / 2] == text[(i - L[i] - 1) / 2])): + L[i]+=1 + except Exception as e: + pass + + if L[i] > maxLPSLength: # Track maxLPSLength + maxLPSLength = L[i] + maxLPSCenterPosition = i + + # If palindrome centered at currentRightPosition i + # expand beyond centerRightPosition R, + # adjust centerPosition C based on expanded palindrome. + if i + L[i] > R: + C = i + R = i + L[i] + + # Uncomment it to print LPS Length array + # printf("%d ", L[i]); + start = (maxLPSCenterPosition - maxLPSLength) / 2 + end = start + maxLPSLength - 1 + print "LPS of string is " + text + " : ", + print text[start:end+1], + print "\n", + +# Driver program +text1 = "babcbabcbaccba" +findLongestPalindromicString(text1) + +text2 = "abaaba" +findLongestPalindromicString(text2) + +text3 = "abababa" +findLongestPalindromicString(text3) + +text4 = "abcbabcbabcba" +findLongestPalindromicString(text4) + +text5 = "forgeeksskeegfor" +findLongestPalindromicString(text5) + +text6 = "caba" +findLongestPalindromicString(text6) + +text7 = "abacdfgdcaba" +findLongestPalindromicString(text7) + +text8 = "abacdfgdcabba" +findLongestPalindromicString(text8) + +text9 = "abacdedcaba" +findLongestPalindromicString(text9) \ No newline at end of file From 2c02dbde154491a4a20a118a4da9e7c0290429cb Mon Sep 17 00:00:00 2001 From: JOSE THOMAS <34163586+josethomas98@users.noreply.github.com> Date: Sat, 27 Oct 2018 09:50:05 +0530 Subject: [PATCH 089/333] manacher algorithm --- .../manachers algorithm/manacher algorithm.py | 89 +++++++++++++++++++ .../manacher algorithm.txt | 89 +++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 Other Algorithms/manachers algorithm/manacher algorithm.py create mode 100644 Other Algorithms/manachers algorithm/manacher algorithm.txt diff --git a/Other Algorithms/manachers algorithm/manacher algorithm.py b/Other Algorithms/manachers algorithm/manacher algorithm.py new file mode 100644 index 000000000..5905eb422 --- /dev/null +++ b/Other Algorithms/manachers algorithm/manacher algorithm.py @@ -0,0 +1,89 @@ +def findLongestPalindromicString(text): + N = len(text) + if N == 0: + return + N = 2*N+1 # Position count + L = [0] * N + L[0] = 0 + L[1] = 1 + C = 1 # centerPosition + R = 2 # centerRightPosition + i = 0 # currentRightPosition + iMirror = 0 # currentLeftPosition + maxLPSLength = 0 + maxLPSCenterPosition = 0 + start = -1 + end = -1 + diff = -1 + + # Uncomment it to print LPS Length array + # printf("%d %d ", L[0], L[1]); + for i in xrange(2,N): + + # get currentLeftPosition iMirror for currentRightPosition i + iMirror = 2*C-i + L[i] = 0 + diff = R - i + # If currentRightPosition i is within centerRightPosition R + if diff > 0: + L[i] = min(L[iMirror], diff) + + # Attempt to expand palindrome centered at currentRightPosition i + # Here for odd positions, we compare characters and + # if match then increment LPS Length by ONE + # If even position, we just increment LPS by ONE without + # any character comparison + try: + while ((i + L[i]) < N and (i - L[i]) > 0) and \ + (((i + L[i] + 1) % 2 == 0) or \ + (text[(i + L[i] + 1) / 2] == text[(i - L[i] - 1) / 2])): + L[i]+=1 + except Exception as e: + pass + + if L[i] > maxLPSLength: # Track maxLPSLength + maxLPSLength = L[i] + maxLPSCenterPosition = i + + # If palindrome centered at currentRightPosition i + # expand beyond centerRightPosition R, + # adjust centerPosition C based on expanded palindrome. + if i + L[i] > R: + C = i + R = i + L[i] + + # Uncomment it to print LPS Length array + # printf("%d ", L[i]); + start = (maxLPSCenterPosition - maxLPSLength) / 2 + end = start + maxLPSLength - 1 + print "LPS of string is " + text + " : ", + print text[start:end+1], + print "\n", + +# Driver program +text1 = "babcbabcbaccba" +findLongestPalindromicString(text1) + +text2 = "abaaba" +findLongestPalindromicString(text2) + +text3 = "abababa" +findLongestPalindromicString(text3) + +text4 = "abcbabcbabcba" +findLongestPalindromicString(text4) + +text5 = "forgeeksskeegfor" +findLongestPalindromicString(text5) + +text6 = "caba" +findLongestPalindromicString(text6) + +text7 = "abacdfgdcaba" +findLongestPalindromicString(text7) + +text8 = "abacdfgdcabba" +findLongestPalindromicString(text8) + +text9 = "abacdedcaba" +findLongestPalindromicString(text9) \ No newline at end of file diff --git a/Other Algorithms/manachers algorithm/manacher algorithm.txt b/Other Algorithms/manachers algorithm/manacher algorithm.txt new file mode 100644 index 000000000..5905eb422 --- /dev/null +++ b/Other Algorithms/manachers algorithm/manacher algorithm.txt @@ -0,0 +1,89 @@ +def findLongestPalindromicString(text): + N = len(text) + if N == 0: + return + N = 2*N+1 # Position count + L = [0] * N + L[0] = 0 + L[1] = 1 + C = 1 # centerPosition + R = 2 # centerRightPosition + i = 0 # currentRightPosition + iMirror = 0 # currentLeftPosition + maxLPSLength = 0 + maxLPSCenterPosition = 0 + start = -1 + end = -1 + diff = -1 + + # Uncomment it to print LPS Length array + # printf("%d %d ", L[0], L[1]); + for i in xrange(2,N): + + # get currentLeftPosition iMirror for currentRightPosition i + iMirror = 2*C-i + L[i] = 0 + diff = R - i + # If currentRightPosition i is within centerRightPosition R + if diff > 0: + L[i] = min(L[iMirror], diff) + + # Attempt to expand palindrome centered at currentRightPosition i + # Here for odd positions, we compare characters and + # if match then increment LPS Length by ONE + # If even position, we just increment LPS by ONE without + # any character comparison + try: + while ((i + L[i]) < N and (i - L[i]) > 0) and \ + (((i + L[i] + 1) % 2 == 0) or \ + (text[(i + L[i] + 1) / 2] == text[(i - L[i] - 1) / 2])): + L[i]+=1 + except Exception as e: + pass + + if L[i] > maxLPSLength: # Track maxLPSLength + maxLPSLength = L[i] + maxLPSCenterPosition = i + + # If palindrome centered at currentRightPosition i + # expand beyond centerRightPosition R, + # adjust centerPosition C based on expanded palindrome. + if i + L[i] > R: + C = i + R = i + L[i] + + # Uncomment it to print LPS Length array + # printf("%d ", L[i]); + start = (maxLPSCenterPosition - maxLPSLength) / 2 + end = start + maxLPSLength - 1 + print "LPS of string is " + text + " : ", + print text[start:end+1], + print "\n", + +# Driver program +text1 = "babcbabcbaccba" +findLongestPalindromicString(text1) + +text2 = "abaaba" +findLongestPalindromicString(text2) + +text3 = "abababa" +findLongestPalindromicString(text3) + +text4 = "abcbabcbabcba" +findLongestPalindromicString(text4) + +text5 = "forgeeksskeegfor" +findLongestPalindromicString(text5) + +text6 = "caba" +findLongestPalindromicString(text6) + +text7 = "abacdfgdcaba" +findLongestPalindromicString(text7) + +text8 = "abacdfgdcabba" +findLongestPalindromicString(text8) + +text9 = "abacdedcaba" +findLongestPalindromicString(text9) \ No newline at end of file From 2ad886acdd34a7afc1883beddf252bb73d5f6923 Mon Sep 17 00:00:00 2001 From: JOSE THOMAS <34163586+josethomas98@users.noreply.github.com> Date: Sat, 27 Oct 2018 10:03:52 +0530 Subject: [PATCH 090/333] m-coloring --- Backtracking/mcoloring/mcoloring.py | 46 +++++++++++++++++++++++++ Backtracking/mcoloring/mcoloring.py.txt | 46 +++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 Backtracking/mcoloring/mcoloring.py create mode 100644 Backtracking/mcoloring/mcoloring.py.txt diff --git a/Backtracking/mcoloring/mcoloring.py b/Backtracking/mcoloring/mcoloring.py new file mode 100644 index 000000000..6d58f929a --- /dev/null +++ b/Backtracking/mcoloring/mcoloring.py @@ -0,0 +1,46 @@ + +class Graph(): + + def __init__(self, vertices): + self.V = vertices + self.graph = [[0 for column in range(vertices)]\ + for row in range(vertices)] + + # A utility function to check if the current color assignment + # is safe for vertex v + def isSafe(self, v, colour, c): + for i in range(self.V): + if self.graph[v][i] == 1 and colour[i] == c: + return False + return True + + # A recursive utility function to solve m + # coloring problem + def graphColourUtil(self, m, colour, v): + if v == self.V: + return True + + for c in range(1, m+1): + if self.isSafe(v, colour, c) == True: + colour[v] = c + if self.graphColourUtil(m, colour, v+1) == True: + return True + colour[v] = 0 + + def graphColouring(self, m): + colour = [0] * self.V + if self.graphColourUtil(m, colour, 0) == False: + return False + + # Print the solution + print "Solution exist and Following are the assigned colours:" + for c in colour: + print c, + return True + +# Driver Code +g = Graph(4) +g.graph = [[0,1,1,1], [1,0,1,0], [1,1,0,1], [1,0,1,0]] +m=3 +g.graphColouring(m) + diff --git a/Backtracking/mcoloring/mcoloring.py.txt b/Backtracking/mcoloring/mcoloring.py.txt new file mode 100644 index 000000000..6d58f929a --- /dev/null +++ b/Backtracking/mcoloring/mcoloring.py.txt @@ -0,0 +1,46 @@ + +class Graph(): + + def __init__(self, vertices): + self.V = vertices + self.graph = [[0 for column in range(vertices)]\ + for row in range(vertices)] + + # A utility function to check if the current color assignment + # is safe for vertex v + def isSafe(self, v, colour, c): + for i in range(self.V): + if self.graph[v][i] == 1 and colour[i] == c: + return False + return True + + # A recursive utility function to solve m + # coloring problem + def graphColourUtil(self, m, colour, v): + if v == self.V: + return True + + for c in range(1, m+1): + if self.isSafe(v, colour, c) == True: + colour[v] = c + if self.graphColourUtil(m, colour, v+1) == True: + return True + colour[v] = 0 + + def graphColouring(self, m): + colour = [0] * self.V + if self.graphColourUtil(m, colour, 0) == False: + return False + + # Print the solution + print "Solution exist and Following are the assigned colours:" + for c in colour: + print c, + return True + +# Driver Code +g = Graph(4) +g.graph = [[0,1,1,1], [1,0,1,0], [1,1,0,1], [1,0,1,0]] +m=3 +g.graphColouring(m) + From 624bdad5f0892cb9a70285c12cc226ad24a351e4 Mon Sep 17 00:00:00 2001 From: akiii1997 Date: Sat, 27 Oct 2018 10:04:34 +0530 Subject: [PATCH 091/333] satack in c --- data structures/stack/c/stack_in_c.c | 221 +++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 data structures/stack/c/stack_in_c.c diff --git a/data structures/stack/c/stack_in_c.c b/data structures/stack/c/stack_in_c.c new file mode 100644 index 000000000..e3fcfeb02 --- /dev/null +++ b/data structures/stack/c/stack_in_c.c @@ -0,0 +1,221 @@ + /* + + * C program to implement stack. Stack is a LIFO data structure. + + * Stack operations: PUSH(insert operation), POP(Delete operation) + + * and Display stack. + + */ + + #include + + #define MAXSIZE 5 + + + + struct stack + + { + + int stk[MAXSIZE]; + + int top; + + }; + + typedef struct stack STACK; + + STACK s; + + + + void push(void); + + int pop(void); + + void display(void); + + + + void main () + + { + + int choice; + + int option = 1; + + s.top = -1; + + + + printf ("STACK OPERATION\n"); + + while (option) + + { + + printf ("------------------------------------------\n"); + + printf (" 1 --> PUSH \n"); + + printf (" 2 --> POP \n"); + + printf (" 3 --> DISPLAY \n"); + + printf (" 4 --> EXIT \n"); + + printf ("------------------------------------------\n"); + + + + printf ("Enter your choice\n"); + + scanf ("%d", &choice); + + switch (choice) + + { + + case 1: + + push(); + + break; + + case 2: + + pop(); + + break; + + case 3: + + display(); + + break; + + case 4: + + return; + + } + + fflush (stdin); + + printf ("Do you want to continue(Type 0 or 1)?\n"); + + scanf ("%d", &option); + + } + + } + + /* Function to add an element to the stack */ + + void push () + + { + + int num; + + if (s.top == (MAXSIZE - 1)) + + { + + printf ("Stack is Full\n"); + + return; + + } + + else + + { + + printf ("Enter the element to be pushed\n"); + + scanf ("%d", &num); + + s.top = s.top + 1; + + s.stk[s.top] = num; + + } + + return; + + } + + /* Function to delete an element from the stack */ + + int pop () + + { + + int num; + + if (s.top == - 1) + + { + + printf ("Stack is Empty\n"); + + return (s.top); + + } + + else + + { + + num = s.stk[s.top]; + + printf ("poped element is = %dn", s.stk[s.top]); + + s.top = s.top - 1; + + } + + return(num); + + } + + /* Function to display the status of the stack */ + + void display () + + { + + int i; + + if (s.top == -1) + + { + + printf ("Stack is empty\n"); + + return; + + } + + else + + { + + printf ("\n The status of the stack is \n"); + + for (i = s.top; i >= 0; i--) + + { + + printf ("%d\n", s.stk[i]); + + } + + } + + printf ("\n"); + + } \ No newline at end of file From 675f020ad5a74fe5a3f17ed3ced661a89aa0df17 Mon Sep 17 00:00:00 2001 From: ankitjain4 <44187577+ankitjain4@users.noreply.github.com> Date: Sat, 27 Oct 2018 10:38:15 +0530 Subject: [PATCH 092/333] Create linkedlist.json --- linkedlist.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 linkedlist.json diff --git a/linkedlist.json b/linkedlist.json new file mode 100644 index 000000000..c3d095563 --- /dev/null +++ b/linkedlist.json @@ -0,0 +1,10 @@ +Step 1. Create a new node and assign the address to any node say ptr. +Step 2. OVERFLOW,IF(PTR = NULL) + write : OVERFLOW and EXIT. +Step 3. ASSIGN INFO[PTR] = ITEM +Step 4. IF(START = NULL) + ASSIGN NEXT[PTR] = NULL + ELSE + ASSIGN NEXT[PTR] = START +Step 5. ASSIGN START = PTR +Step 6. EXIT From b0db107d55f52a1910f4501c5cb1b51ba747ed3d Mon Sep 17 00:00:00 2001 From: stubborntoddler <36149177+stubborntoddler@users.noreply.github.com> Date: Sat, 27 Oct 2018 10:44:53 +0530 Subject: [PATCH 093/333] greedy --- greedy | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 greedy diff --git a/greedy b/greedy new file mode 100644 index 000000000..031372cf7 --- /dev/null +++ b/greedy @@ -0,0 +1,42 @@ +// The following implementation assumes that the activities +// are already sorted according to their finish time +#include + +// Prints a maximum set of activities that can be done by a single +// person, one at a time. +// n --> Total number of activities +// s[] --> An array that contains start time of all activities +// f[] --> An array that contains finish time of all activities +void printMaxActivities(int s[], int f[], int n) +{ + int i, j; + + printf ("Following activities are selected n"); + + // The first activity always gets selected + i = 0; + printf("%d ", i); + + // Consider rest of the activities + for (j = 1; j < n; j++) + { + // If this activity has start time greater than or + // equal to the finish time of previously selected + // activity, then select it + if (s[j] >= f[i]) + { + printf ("%d ", j); + i = j; + } + } +} + +// driver program to test above function +int main() +{ + int s[] = {1, 3, 0, 5, 8, 5}; + int f[] = {2, 4, 6, 7, 9, 9}; + int n = sizeof(s)/sizeof(s[0]); + printMaxActivities(s, f, n); + return 0; +} From 3fbd19e43054c3df769b0b56ccf3ce219ca5b0d7 Mon Sep 17 00:00:00 2001 From: Maaz Khan Date: Sat, 27 Oct 2018 10:51:46 +0530 Subject: [PATCH 094/333] Python Implememtation of Tim Sort --- Sorting/Timsort/Python/TimSort.py | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Sorting/Timsort/Python/TimSort.py diff --git a/Sorting/Timsort/Python/TimSort.py b/Sorting/Timsort/Python/TimSort.py new file mode 100644 index 000000000..ce80f41a3 --- /dev/null +++ b/Sorting/Timsort/Python/TimSort.py @@ -0,0 +1,85 @@ +# based off of this code https://gist.github.com/nandajavarma/a3a6b62f34e74ec4c31674934327bbd3 +# Brandon Skerritt +# https://skerritt.tech + +def binary_search(the_array, item, start, end): + if start == end: + if the_array[start] > item: + return start + else: + return start + 1 + if start > end: + return start + + mid = round((start + end)/ 2) + + if the_array[mid] < item: + return binary_search(the_array, item, mid + 1, end) + + elif the_array[mid] > item: + return binary_search(the_array, item, start, mid - 1) + + else: + return mid + +""" +Insertion sort that timsort uses if the array size is small or if +the size of the "run" is small +""" +def insertion_sort(the_array): + l = len(the_array) + for index in range(1, l): + value = the_array[index] + pos = binary_search(the_array, value, 0, index - 1) + the_array = the_array[:pos] + [value] + the_array[pos:index] + the_array[index+1:] + return the_array + +def merge(left, right): + """Takes two sorted lists and returns a single sorted list by comparing the + elements one at a time. + [1, 2, 3, 4, 5, 6] + """ + if not left: + return right + if not right: + return left + if left[0] < right[0]: + return [left[0]] + merge(left[1:], right) + return [right[0]] + merge(left, right[1:]) + +def timsort(the_array): + runs, sorted_runs = [], [] + length = len(the_array) + new_run = [the_array[0]] + + # for every i in the range of 1 to length of array + for i in range(1, length): + # if i is at the end of the list + if i == length - 1: + new_run.append(the_array[i]) + runs.append(new_run) + break + # if the i'th element of the array is less than the one before it + if the_array[i] < the_array[i-1]: + # if new_run is set to None (NULL) + if not new_run: + runs.append([the_array[i]]) + new_run.append(the_array[i]) + else: + runs.append(new_run) + new_run = [] + # else if its equal to or more than + else: + new_run.append(the_array[i]) + + # for every item in runs, append it using insertion sort + for item in runs: + sorted_runs.append(insertion_sort(item)) + + # for every run in sorted_runs, merge them + sorted_array = [] + for run in sorted_runs: + sorted_array = merge(sorted_array, run) + + print(sorted_array) +timsort([2, 3, 1, 5, 6, 7]) \ No newline at end of file From 4514e9216168fdf587d33aff81d902835b9004e4 Mon Sep 17 00:00:00 2001 From: Mohamed Kamal El-Shazly Date: Sat, 27 Oct 2018 08:20:13 +0200 Subject: [PATCH 095/333] Add Dijkstras in C# Add Dijkstras in C# --- Graphs/Dijkstra Algorithm/C#/Dijkstra.cs | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Graphs/Dijkstra Algorithm/C#/Dijkstra.cs diff --git a/Graphs/Dijkstra Algorithm/C#/Dijkstra.cs b/Graphs/Dijkstra Algorithm/C#/Dijkstra.cs new file mode 100644 index 000000000..05da1079c --- /dev/null +++ b/Graphs/Dijkstra Algorithm/C#/Dijkstra.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Diagnostics; +namespace DijkstraAlgorithm +{ + class Dijkstra + { + private static int MinimumDistance(int[] distance, bool[] shortestPathTreeSet, int verticesCount) + { + int min = int.MaxValue; + int minIndex = 0; + for (int v = 0; v < verticesCount; ++v) + { + if (shortestPathTreeSet[v] == false && distance[v] <= min) + { + min = distance[v]; + minIndex = v; + } + } + return minIndex; + } + private static void Print(int[] distance, int verticesCount) + { + Console.WriteLine("Vertex Distance from source"); + for (int i = 0; i < verticesCount; ++i) + Console.WriteLine("{0}\t {1}", i, distance[i]); + } + public static void DijkstraAlgo(int[,] graph, int source, int verticesCount) + { + int[] distance = new int[verticesCount]; + bool[] shortestPathTreeSet = new bool[verticesCount]; + for (int i = 0; i < verticesCount; ++i) + { + distance[i] = int.MaxValue; + shortestPathTreeSet[i] = false; + } + distance[source] = 0; + for (int count = 0; count < verticesCount - 1; ++count) + { + int u = MinimumDistance(distance, shortestPathTreeSet, verticesCount); + shortestPathTreeSet[u] = true; + for (int v = 0; v < verticesCount; ++v) + if (!shortestPathTreeSet[v] && Convert.ToBoolean(graph[u, v]) && distance[u] != int.MaxValue && distance[u] + graph[u, v] < distance[v]) + distance[v] = distance[u] + graph[u, v]; + } + Print(distance, verticesCount); + } + static void Main(string[] args) + { + int[,] graph = { + { 0, 6, 0, 0, 0, 0, 0, 9, 0 }, + { 6, 0, 9, 0, 0, 0, 0, 11, 0 }, + { 0, 9, 0, 5, 0, 6, 0, 0, 2 }, + { 0, 0, 5, 0, 9, 16, 0, 0, 0 }, + { 0, 0, 0, 9, 0, 10, 0, 0, 0 }, + { 0, 0, 6, 0, 10, 0, 2, 0, 0 }, + { 0, 0, 0, 16, 0, 2, 0, 1, 6 }, + { 9, 11, 0, 0, 0, 0, 1, 0, 5 }, + { 0, 0, 2, 0, 0, 0, 6, 5, 0 } + }; + DijkstraAlgo(graph, 0, 9); + } + } +} \ No newline at end of file From ebae45b4091accd79f576774dea11dfbeb94c486 Mon Sep 17 00:00:00 2001 From: Gowthamy Vaseekaran Date: Sat, 27 Oct 2018 12:00:51 +0530 Subject: [PATCH 096/333] Update md file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94a031855..d6fb347ea 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Clean example implementations of data structures and algorithms written in diffe * Graphical examples would be very helpful too. * Don't forget to include tests. * Don't remove previous implementations of algorithms. Just add a new file with your own implementation. - * Beautify and cleanup your code for easier reading + * Beautify and clean up your code for easier reading ## Resources From c69a8ca1e1c559e8d8e80b1112b59a5297e2670f Mon Sep 17 00:00:00 2001 From: Lakshyajit Laxmikant <30868587+lakshyajit165@users.noreply.github.com> Date: Sat, 27 Oct 2018 12:09:59 +0530 Subject: [PATCH 097/333] Create All_permutations_of_a_string Adding new File --- .../All_permutations_of_a_string.cpp | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Other Algorithms/All_permutations_of_a_string.cpp diff --git a/Other Algorithms/All_permutations_of_a_string.cpp b/Other Algorithms/All_permutations_of_a_string.cpp new file mode 100644 index 000000000..0cd6e59f2 --- /dev/null +++ b/Other Algorithms/All_permutations_of_a_string.cpp @@ -0,0 +1,48 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: main.cpp + * Author: Elkay + * + * Created on 17 October, 2018, 10:26 PM + */ + +#include + +using namespace std; + +void swap(char *x, char *y){ + char temp; + temp = *x; + *x = *y; + *y = temp; +} +void permute(char *a, int l, int r){ + int i; + if(l == r){ + cout<>s; + int n = s.length(); + + char str[n+1]; + strcpy(str,s.c_str()); + permute(str,0,n-1); + return 0; +} + From c4b62c55f0889c8c537e6730bc6b5a20f3bf0cc4 Mon Sep 17 00:00:00 2001 From: Anandhu Gopi Date: Sat, 27 Oct 2018 12:12:09 +0530 Subject: [PATCH 098/333] Created factorial using recursion in java I implemented factorial using recursion in java please review my code and accept my pull reuest --- Recursive Algorithms/Java/factorial.java | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Recursive Algorithms/Java/factorial.java diff --git a/Recursive Algorithms/Java/factorial.java b/Recursive Algorithms/Java/factorial.java new file mode 100644 index 000000000..82e440532 --- /dev/null +++ b/Recursive Algorithms/Java/factorial.java @@ -0,0 +1,34 @@ +import java.util.Scanner; + + +public class Factorial { + + static int findFactorial( Integer number ) + { + if( number == 0 ) + return 1; + else if( number==1 ) + return 1; + + return number*findFactorial(number-1); + } + + public static void main(String[] args) { + + System.out.println("Enter the number for Factoial"); + Scanner read = new Scanner(System.in); + String input = read.nextLine(); + + //Ensuring that the input is only a number + while ( ! input.matches("[0-9]+") ) + { + System.out.println("Enter a valid number"); + input = read.nextLine(); + } + Integer number=Integer.parseInt(input); + Integer factorial = findFactorial(number); + System.out.println("Factorial of " + number + " is " + factorial); + + } + +} From 8a66160f3d926b90c814c7da9feede2e44530bbc Mon Sep 17 00:00:00 2001 From: Thinesh Date: Sat, 27 Oct 2018 12:24:35 +0530 Subject: [PATCH 099/333] Add Find duplicate character in string algorithm --- .../String/java/FindDuplicateCharacters.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Other Algorithms/String/java/FindDuplicateCharacters.java diff --git a/Other Algorithms/String/java/FindDuplicateCharacters.java b/Other Algorithms/String/java/FindDuplicateCharacters.java new file mode 100644 index 000000000..626242f5f --- /dev/null +++ b/Other Algorithms/String/java/FindDuplicateCharacters.java @@ -0,0 +1,36 @@ +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; + +/** + * Java Program to find duplicate characters in String. + */ +public class FindDuplicateCharacters { + public static void main(String args[]) { + printDuplicateCharacters("Programming"); + printDuplicateCharacters("Language"); + printDuplicateCharacters("Hello"); + printDuplicateCharacters("Java"); + } /* * Find all duplicate characters in a String and print each of them. */ + + public static void printDuplicateCharacters(String word) { + char[] characters = word.toCharArray(); + Map charMap = new HashMap(); + for (Character ch : characters) { + if (charMap.containsKey(ch)) { + charMap.put(ch, charMap.get(ch) + 1); + } else { + charMap.put(ch, 1); + } + } + Set> entrySet = charMap.entrySet(); + System.out.printf("List of duplicate characters in String '%s' %n", word); + for (Map.Entry entry : entrySet) { + if (entry.getValue() > 1) { + System.out.printf("%s : %d %n", entry.getKey(), entry.getValue()); + } + } + } +} + From dfb04fc8c18bf1fc3b25aabe6a741858addac4b0 Mon Sep 17 00:00:00 2001 From: Thinesh Date: Sat, 27 Oct 2018 12:29:37 +0530 Subject: [PATCH 100/333] Refactor code --- Other Algorithms/String/java/FindDuplicateCharacters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Other Algorithms/String/java/FindDuplicateCharacters.java b/Other Algorithms/String/java/FindDuplicateCharacters.java index 626242f5f..c9b6fa6ef 100644 --- a/Other Algorithms/String/java/FindDuplicateCharacters.java +++ b/Other Algorithms/String/java/FindDuplicateCharacters.java @@ -10,7 +10,7 @@ public class FindDuplicateCharacters { public static void main(String args[]) { printDuplicateCharacters("Programming"); printDuplicateCharacters("Language"); - printDuplicateCharacters("Hello"); + printDuplicateCharacters("HelloWorld"); printDuplicateCharacters("Java"); } /* * Find all duplicate characters in a String and print each of them. */ From d2f5f430d8fe63adf39c83b8fc5d2f1b9ff19d12 Mon Sep 17 00:00:00 2001 From: kumarvishalgupta <44518288+kumarvishalgupta@users.noreply.github.com> Date: Sat, 27 Oct 2018 12:29:47 +0530 Subject: [PATCH 101/333] Heavy Light Decomposition --- Heavy Light Decomposition.txt | 157 ++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 Heavy Light Decomposition.txt diff --git a/Heavy Light Decomposition.txt b/Heavy Light Decomposition.txt new file mode 100644 index 000000000..bb2161e94 --- /dev/null +++ b/Heavy Light Decomposition.txt @@ -0,0 +1,157 @@ +#include +#define maxn 100001 +using namespace std; +vectorv[maxn],arr[maxn],t[maxn]; +int p[maxn],d[maxn],sz[maxn],nxt[maxn],a[maxn],chain[maxn],szc[maxn],st[maxn],top[maxn],nd=0,tim=0,seg[4*maxn+1],lazy[4*maxn+1],n; +int dfs(int s,int r) +{ + p[s]=r; + d[s]=d[r]+1; + sz[s]=1; + for(int i=0;isz[nxt[s]]) + nxt[s]=x; + } + return sz[s]; +} +void hld(int s,int pp=0) +{ + chain[s]=nd; + st[s]=++tim; + if(!szc[nd]) + {top[nd]=s;} + szc[nd]++; + + if(nxt[s]!=-1) + hld(nxt[s],s); + + for(int i=0;ien || rr || seg[x]) + return ; + if(l<=st && en<=r) + { + seg[x]=val; + if(st!=en) + { + if(!seg[2*x]) + lazy[2*x]=val; + if(!seg[2*x+1]) + lazy[2*x+1]=val; + } + return ; + } + int mid=(st+en)/2; + update(2*x,st,mid,l,r,val); + update(2*x+1,mid+1,en,l,r,val); + if(seg[2*x] && seg[2*x+1] && !seg[x]) + seg[x]=seg[2*x]; +} +void go(int x,int y,int val) +{ + int sx=st[x],sy=st[y],sny,snx; + while(chain[x]!=chain[y]) + { + if(d[top[chain[x]]]d[y])swap(x,y); + snx=st[x];sny=st[y]; + if(st[x]==sx || st[x]==sy)snx=st[x]+1; + if(st[y]==sx || st[y]==sy)sny=st[y]-1; + update(1,1,n,snx,sny,val); +} +int qry(int x,int l,int r,int ind) +{ + if(lazy[x]) + { + seg[x]=lazy[x]; + if(l!=r) + { + if(!seg[2*x]) + lazy[2*x]=lazy[x]; + if(!seg[2*x+1]) + lazy[2*x+1]=lazy[x]; + } + lazy[x]=0; + } + if(indr) + return 0; + + if(l==r) + return seg[x]; + int mid=(l+r)/2; + return (qry(2*x,l,mid,ind)+qry(2*x+1,mid+1,r,ind)); +} +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(0); + cout.tie(0); + int x,y; + for(int i=1;i<=maxn;i++) + for(int j=i;j<=maxn;j+=i) + v[j].push_back(i); + cin>>n; + for(int i=1;i<=n;i++) + { + cin>>a[i]; + for(int j=0;j>x>>y; + t[x].push_back(y); + t[y].push_back(x); + } + memset(p,-1,sizeof(p)); + memset(nxt,-1,sizeof(nxt)); + memset(chain,-1,sizeof(chain)); + dfs(1,0);p[1]=-1; + hld(1); + for(int i=maxn;i>=1;i--) + if(arr[i].size()>1) + { + + x=arr[i][0];y=arr[i][arr[i].size()-1]; + for(int j=1;j Date: Sat, 27 Oct 2018 12:59:23 +0530 Subject: [PATCH 102/333] Revert commit --- .../String/java/FindDuplicateCharacters.java | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 Other Algorithms/String/java/FindDuplicateCharacters.java diff --git a/Other Algorithms/String/java/FindDuplicateCharacters.java b/Other Algorithms/String/java/FindDuplicateCharacters.java deleted file mode 100644 index c9b6fa6ef..000000000 --- a/Other Algorithms/String/java/FindDuplicateCharacters.java +++ /dev/null @@ -1,36 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; -import java.util.Set; - -/** - * Java Program to find duplicate characters in String. - */ -public class FindDuplicateCharacters { - public static void main(String args[]) { - printDuplicateCharacters("Programming"); - printDuplicateCharacters("Language"); - printDuplicateCharacters("HelloWorld"); - printDuplicateCharacters("Java"); - } /* * Find all duplicate characters in a String and print each of them. */ - - public static void printDuplicateCharacters(String word) { - char[] characters = word.toCharArray(); - Map charMap = new HashMap(); - for (Character ch : characters) { - if (charMap.containsKey(ch)) { - charMap.put(ch, charMap.get(ch) + 1); - } else { - charMap.put(ch, 1); - } - } - Set> entrySet = charMap.entrySet(); - System.out.printf("List of duplicate characters in String '%s' %n", word); - for (Map.Entry entry : entrySet) { - if (entry.getValue() > 1) { - System.out.printf("%s : %d %n", entry.getKey(), entry.getValue()); - } - } - } -} - From 839a8ab2c117492a5e70fd3f533f64128bbdc699 Mon Sep 17 00:00:00 2001 From: Pratiyush27 <41360455+Pratiyush27@users.noreply.github.com> Date: Sat, 27 Oct 2018 12:59:33 +0530 Subject: [PATCH 103/333] Queues using data structure Queues using data structure in c --- data structures/queue/c/queue_using_stack.c | 89 +++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 data structures/queue/c/queue_using_stack.c diff --git a/data structures/queue/c/queue_using_stack.c b/data structures/queue/c/queue_using_stack.c new file mode 100644 index 000000000..3c7a84eee --- /dev/null +++ b/data structures/queue/c/queue_using_stack.c @@ -0,0 +1,89 @@ +/* C Program to implement a queue using two stacks */ +#include +#include +/* structure of a stack node */ +struct sNode +{ + int data; + struct sNode* next; +}; +void push(struct sNode** top_ref, int new_data); +int pop(struct sNode** top_ref); +/* structure of queue having two stacks */ +struct queue +{ + struct sNode* stack1; + struct sNode* stack2; +}; +void enQueue(struct queue* q, int x) +{ + push(&q->stack1, x); +} +int deQueue(struct queue* q) +{ + int x; + if (q->stack1 == NULL && q->stack2 == NULL) + { + printf("Q is empty"); + getchar(); + exit(0); + } +/* Move elements from stack1 to stack 2 only if + stack2 is empty */ + if (q->stack2 == NULL) + { + while (q->stack1 != NULL) + { + x = pop(&q->stack1); + push(&q->stack2, x); + } + } + x = pop(&q->stack2); + return x; +} +void push(struct sNode** top_ref, int new_data) +{ + struct sNode* new_node = (struct sNode*)malloc(sizeof(struct sNode)); + if (new_node == NULL) + { + printf("Stack overflow \n"); + getchar(); + exit(0); + } + new_node->data = new_data; + new_node->next = (*top_ref); + (*top_ref) = new_node; +} +int pop(struct sNode** top_ref) +{ + int res; + struct sNode* top; + if (*top_ref == NULL) + { + printf("Stack underflow \n"); + getchar(); + exit(0); + } + else + { + top = *top_ref; + res = top->data; + *top_ref = top->next; + free(top); + return res; + } +} +int main() +{ + struct queue* q = (struct queue*)malloc(sizeof(struct queue)); + q->stack1 = NULL; + q->stack2 = NULL; + enQueue(q, 1); + enQueue(q, 2); + enQueue(q, 3); + printf("%d ", deQueue(q)); + printf("%d ", deQueue(q)); + printf("%d ", deQueue(q)); + return 0; +} + From f0cd260f8d420cadfac5557650ec33dbe0bf1bce Mon Sep 17 00:00:00 2001 From: Pratiyush27 <41360455+Pratiyush27@users.noreply.github.com> Date: Sat, 27 Oct 2018 13:00:27 +0530 Subject: [PATCH 104/333] Delete queue_using_stack.c --- data structures/queue/c/queue_using_stack.c | 89 --------------------- 1 file changed, 89 deletions(-) delete mode 100644 data structures/queue/c/queue_using_stack.c diff --git a/data structures/queue/c/queue_using_stack.c b/data structures/queue/c/queue_using_stack.c deleted file mode 100644 index 3c7a84eee..000000000 --- a/data structures/queue/c/queue_using_stack.c +++ /dev/null @@ -1,89 +0,0 @@ -/* C Program to implement a queue using two stacks */ -#include -#include -/* structure of a stack node */ -struct sNode -{ - int data; - struct sNode* next; -}; -void push(struct sNode** top_ref, int new_data); -int pop(struct sNode** top_ref); -/* structure of queue having two stacks */ -struct queue -{ - struct sNode* stack1; - struct sNode* stack2; -}; -void enQueue(struct queue* q, int x) -{ - push(&q->stack1, x); -} -int deQueue(struct queue* q) -{ - int x; - if (q->stack1 == NULL && q->stack2 == NULL) - { - printf("Q is empty"); - getchar(); - exit(0); - } -/* Move elements from stack1 to stack 2 only if - stack2 is empty */ - if (q->stack2 == NULL) - { - while (q->stack1 != NULL) - { - x = pop(&q->stack1); - push(&q->stack2, x); - } - } - x = pop(&q->stack2); - return x; -} -void push(struct sNode** top_ref, int new_data) -{ - struct sNode* new_node = (struct sNode*)malloc(sizeof(struct sNode)); - if (new_node == NULL) - { - printf("Stack overflow \n"); - getchar(); - exit(0); - } - new_node->data = new_data; - new_node->next = (*top_ref); - (*top_ref) = new_node; -} -int pop(struct sNode** top_ref) -{ - int res; - struct sNode* top; - if (*top_ref == NULL) - { - printf("Stack underflow \n"); - getchar(); - exit(0); - } - else - { - top = *top_ref; - res = top->data; - *top_ref = top->next; - free(top); - return res; - } -} -int main() -{ - struct queue* q = (struct queue*)malloc(sizeof(struct queue)); - q->stack1 = NULL; - q->stack2 = NULL; - enQueue(q, 1); - enQueue(q, 2); - enQueue(q, 3); - printf("%d ", deQueue(q)); - printf("%d ", deQueue(q)); - printf("%d ", deQueue(q)); - return 0; -} - From 9c9ba4727b0d1a7a4dbcb859a83c3ba543b69fbb Mon Sep 17 00:00:00 2001 From: Pratiyush27 <41360455+Pratiyush27@users.noreply.github.com> Date: Sat, 27 Oct 2018 13:01:06 +0530 Subject: [PATCH 105/333] Queues using stack Queues using stack in c --- data structures/queue/c/queue_using_stack.c | 89 +++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 data structures/queue/c/queue_using_stack.c diff --git a/data structures/queue/c/queue_using_stack.c b/data structures/queue/c/queue_using_stack.c new file mode 100644 index 000000000..3c7a84eee --- /dev/null +++ b/data structures/queue/c/queue_using_stack.c @@ -0,0 +1,89 @@ +/* C Program to implement a queue using two stacks */ +#include +#include +/* structure of a stack node */ +struct sNode +{ + int data; + struct sNode* next; +}; +void push(struct sNode** top_ref, int new_data); +int pop(struct sNode** top_ref); +/* structure of queue having two stacks */ +struct queue +{ + struct sNode* stack1; + struct sNode* stack2; +}; +void enQueue(struct queue* q, int x) +{ + push(&q->stack1, x); +} +int deQueue(struct queue* q) +{ + int x; + if (q->stack1 == NULL && q->stack2 == NULL) + { + printf("Q is empty"); + getchar(); + exit(0); + } +/* Move elements from stack1 to stack 2 only if + stack2 is empty */ + if (q->stack2 == NULL) + { + while (q->stack1 != NULL) + { + x = pop(&q->stack1); + push(&q->stack2, x); + } + } + x = pop(&q->stack2); + return x; +} +void push(struct sNode** top_ref, int new_data) +{ + struct sNode* new_node = (struct sNode*)malloc(sizeof(struct sNode)); + if (new_node == NULL) + { + printf("Stack overflow \n"); + getchar(); + exit(0); + } + new_node->data = new_data; + new_node->next = (*top_ref); + (*top_ref) = new_node; +} +int pop(struct sNode** top_ref) +{ + int res; + struct sNode* top; + if (*top_ref == NULL) + { + printf("Stack underflow \n"); + getchar(); + exit(0); + } + else + { + top = *top_ref; + res = top->data; + *top_ref = top->next; + free(top); + return res; + } +} +int main() +{ + struct queue* q = (struct queue*)malloc(sizeof(struct queue)); + q->stack1 = NULL; + q->stack2 = NULL; + enQueue(q, 1); + enQueue(q, 2); + enQueue(q, 3); + printf("%d ", deQueue(q)); + printf("%d ", deQueue(q)); + printf("%d ", deQueue(q)); + return 0; +} + From 976ef8640aa178c7418591509326b75ed09456c9 Mon Sep 17 00:00:00 2001 From: Thinesh Date: Sat, 27 Oct 2018 13:02:45 +0530 Subject: [PATCH 106/333] Revert commit --- Other Algorithms/String/java/FindDuplicateCharacters .java | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Other Algorithms/String/java/FindDuplicateCharacters .java diff --git a/Other Algorithms/String/java/FindDuplicateCharacters .java b/Other Algorithms/String/java/FindDuplicateCharacters .java new file mode 100644 index 000000000..e69de29bb From 0f2806f619bd6f9b327b56cf81f8e4957975f6d0 Mon Sep 17 00:00:00 2001 From: Gowthamy Vaseekaran Date: Sat, 27 Oct 2018 13:06:28 +0530 Subject: [PATCH 107/333] Add find duplicate character algorithm for java --- FindDuplicateCharacters.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 FindDuplicateCharacters.java diff --git a/FindDuplicateCharacters.java b/FindDuplicateCharacters.java new file mode 100644 index 000000000..6f96bac62 --- /dev/null +++ b/FindDuplicateCharacters.java @@ -0,0 +1,36 @@ +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; + +/** + * Java Program to find duplicate characters in String. + */ +public class FindDuplicateCharacters { + public static void main(String args[]) { + printDuplicateCharacters("Programming"); + printDuplicateCharacters("Language"); + printDuplicateCharacters("HelloWorld"); + printDuplicateCharacters("Java"); + } /* * Find all duplicate characters in a String and print each of them. */ + + public static void printDuplicateCharacters(String word) { + char[] characters = word.toCharArray(); + Map charMap = new HashMap(); + for (Character ch : characters) { + if (charMap.containsKey(ch)) { + charMap.put(ch, charMap.get(ch) + 1); + } else { + charMap.put(ch, 1); + } + } + Set> entrySet = charMap.entrySet(); + System.out.printf("List of duplicate characters in String '%s' %n", word); + for (Map.Entry entry : entrySet) { + if (entry.getValue() > 1) { + System.out.printf("%s : %d %n", entry.getKey(), entry.getValue()); + } + } + } +} + From 4a30c6451f4a53b5c6e969ee0538b262f169cef5 Mon Sep 17 00:00:00 2001 From: sandalu <33679455+sandalu@users.noreply.github.com> Date: Sat, 27 Oct 2018 13:12:16 +0530 Subject: [PATCH 108/333] Add bainary search rec --- .../binary search/java/BinarySearchRe.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Searching/binary search/java/BinarySearchRe.java diff --git a/Searching/binary search/java/BinarySearchRe.java b/Searching/binary search/java/BinarySearchRe.java new file mode 100644 index 000000000..292e20e21 --- /dev/null +++ b/Searching/binary search/java/BinarySearchRe.java @@ -0,0 +1,46 @@ +// Java implementation of recursive Binary Search +class BinarySearch +{ + // Returns index of x if it is present in arr[l.. + // r], else return -1 + int binarySearch(int arr[], int l, int r, int x) + { + if (r>=l) + { + int mid = l + (r - l)/2; + + // If the element is present at the + // middle itself + if (arr[mid] == x) + return mid; + + // If element is smaller than mid, then + // it can only be present in left subarray + if (arr[mid] > x) + return binarySearch(arr, l, mid-1, x); + + // Else the element can only be present + // in right subarray + return binarySearch(arr, mid+1, r, x); + } + + // We reach here when element is not present + // in array + return -1; + } + + // Driver method to test above + public static void main(String args[]) + { + BinarySearch ob = new BinarySearch(); + int arr[] = {2,3,4,10,40}; + int n = arr.length; + int x = 10; + int result = ob.binarySearch(arr,0,n-1,x); + if (result == -1) + System.out.println("Element not present"); + else + System.out.println("Element found at index " + + result); + } +} \ No newline at end of file From 6370b93c6026ede7a7aff966b9ff289c8e62ae49 Mon Sep 17 00:00:00 2001 From: Gowthamy Vaseekaran Date: Sat, 27 Oct 2018 13:16:37 +0530 Subject: [PATCH 109/333] Add 'find string permutation' algorithm for string --- .../String/java/StringPermutations.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Other Algorithms/String/java/StringPermutations.java diff --git a/Other Algorithms/String/java/StringPermutations.java b/Other Algorithms/String/java/StringPermutations.java new file mode 100644 index 000000000..ea8857cf2 --- /dev/null +++ b/Other Algorithms/String/java/StringPermutations.java @@ -0,0 +1,38 @@ +/** + * Java program to find all permutations of a given String using recursion. + * For example, given a String "XYZ", this program will print all 6 possible permutations of + * input e.g. XYZ, XZY, YXZ, YZX, ZXY, XYX + */ +public class StringPermutations { + + public static void main(String args[]) { + permutation("123"); + } + + + /* + * A method exposed to client to calculate permutation of String in Java. + */ + public static void permutation(String input){ + permutation("", input); + } + + /* + * Recursive method which actually prints all permutations + * of given String, but since we are passing an empty String + * as current permutation to start with, + * I have made this method private and didn't exposed it to client. + */ + private static void permutation(String perm, String word) { + if (word.isEmpty()) { + System.err.println(perm + word); + + } else { + for (int i = 0; i < word.length(); i++) { + permutation(perm + word.charAt(i), word.substring(0, i) + + word.substring(i + 1, word.length())); + } + } + + } +} \ No newline at end of file From c70623f4fe3213d45264a2d81cfe32f3cb139c50 Mon Sep 17 00:00:00 2001 From: sandalu <33679455+sandalu@users.noreply.github.com> Date: Sat, 27 Oct 2018 13:36:35 +0530 Subject: [PATCH 110/333] new Algorithm --- Searching/Linear Search/LinearSearchRec.java | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Searching/Linear Search/LinearSearchRec.java diff --git a/Searching/Linear Search/LinearSearchRec.java b/Searching/Linear Search/LinearSearchRec.java new file mode 100644 index 000000000..779b2fbf9 --- /dev/null +++ b/Searching/Linear Search/LinearSearchRec.java @@ -0,0 +1,21 @@ + +// Java code for linearly search x in arr[]. If x +// is present then return its location, otherwise +// return -1 +class LinearSearch +{ + // This function returns index of element x in arr[] + static int search(int arr[], int n, int x) + { + for (int i = 0; i < n; i++) + { + // Return the index of the element if the element + // is found + if (arr[i] == x) + return i; + } + + // return -1 if the element is not found + return -1; + } +} \ No newline at end of file From 2605f8ca70a5971132849f65bd466bb4e8037ef8 Mon Sep 17 00:00:00 2001 From: Mehul Garg Date: Sat, 27 Oct 2018 13:40:04 +0530 Subject: [PATCH 111/333] Create log2n.java Added code in java for calculating log2n --- Mathematics/log 2 n/log2n.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Mathematics/log 2 n/log2n.java diff --git a/Mathematics/log 2 n/log2n.java b/Mathematics/log 2 n/log2n.java new file mode 100644 index 000000000..394d958e9 --- /dev/null +++ b/Mathematics/log 2 n/log2n.java @@ -0,0 +1,16 @@ +import java.util.*; +import java.lang.*; +import java.io.*; +class log2n +{ + public static double log2(int n) + { + return Math.log(n) / Math.log(2); + } + public static void main (String[] args) throws Exception + { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + System.out.println(log2(n)); + } +} From fdff9556b08d5492ef360d7ae2fd6d56eb12dee6 Mon Sep 17 00:00:00 2001 From: krit26 <35265057+krit26@users.noreply.github.com> Date: Sat, 27 Oct 2018 14:19:21 +0530 Subject: [PATCH 112/333] Create Nqueens.java --- Backtracking/Nqueens.java | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Backtracking/Nqueens.java diff --git a/Backtracking/Nqueens.java b/Backtracking/Nqueens.java new file mode 100644 index 000000000..a706ea712 --- /dev/null +++ b/Backtracking/Nqueens.java @@ -0,0 +1,63 @@ +import java.io.*; +import java.util.*; + + +public class Nqueens +{ + static HashSet ldia = new HashSet(); + static HashSet rdia = new HashSet(); + public static void find(int count,int ro,HashSet row,HashSet col,int A,ArrayList temp,StringBuilder build,StringBuilder dummy,ArrayList> ans) + { + if(count == A) + { + ans.add(new ArrayList(temp)); + return; + } + for(int i=0;i> solveNQueens(int A) + { + StringBuilder build = new StringBuilder(); + StringBuilder dummy = new StringBuilder(); + ArrayList> ans = new ArrayList<>(); + for(int i=0;i row = new HashSet<>(); + HashSet col = new HashSet<>(); + ArrayList temp = new ArrayList<>(); + find(0,0,row,col,A,temp,build,dummy,ans); + return ans; + } + public static void main(String[] args) + { + Scanner in = new Scanner(System.in); + System.out.print("Enter the size of ChessBoard : "); + int n = in.nextInt(); + ArrayList> ans = solveNQueens(n); + for(int i=0;i temp = ans.get(i); + for(int j=0;j Date: Sat, 27 Oct 2018 14:45:44 +0530 Subject: [PATCH 113/333] Longest Palindromic Subsequence of a given string --- .../LongestPalindromicSubsequence.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Dynamic Programming/LongestPalindromicSubsequence.cpp diff --git a/Dynamic Programming/LongestPalindromicSubsequence.cpp b/Dynamic Programming/LongestPalindromicSubsequence.cpp new file mode 100644 index 000000000..da4e82953 --- /dev/null +++ b/Dynamic Programming/LongestPalindromicSubsequence.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; + +int lps(string s){ + int n=s.length(); + int lps[n][n]; + // length 1 + for(int i=0 ; i Date: Sat, 27 Oct 2018 15:55:10 +0530 Subject: [PATCH 114/333] Sum of digits of a Number (Using Recursion) A Recursive implementation to find the sum of digits of a number --- .../SumOfDigits/cpp/SumOfDigits.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Recursive Algorithms/SumOfDigits/cpp/SumOfDigits.cpp diff --git a/Recursive Algorithms/SumOfDigits/cpp/SumOfDigits.cpp b/Recursive Algorithms/SumOfDigits/cpp/SumOfDigits.cpp new file mode 100644 index 000000000..6c591eb04 --- /dev/null +++ b/Recursive Algorithms/SumOfDigits/cpp/SumOfDigits.cpp @@ -0,0 +1,16 @@ +/* A Recursive implementation to find sum of digits of a number*/ +#include +using namespace std; + +int sumOfDigits(int n){ + if(n == 0) return 0; + + return n%10+sumOfDigits(n/10); +} + +int main() +{ + int n=1729; + cout << "Sum of Digits of " << n << " is " << sumOfDigits(n) << endl; + return 0; +} From a20915284341ce1e34eb581d80da6a125c5fa75c Mon Sep 17 00:00:00 2001 From: Aditya Date: Sat, 27 Oct 2018 17:00:55 +0530 Subject: [PATCH 115/333] Adding a Fibonacci Search in C --- Searching/Fibonacci Search/fibonacci_search.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Searching/Fibonacci Search/fibonacci_search.c diff --git a/Searching/Fibonacci Search/fibonacci_search.c b/Searching/Fibonacci Search/fibonacci_search.c new file mode 100644 index 000000000..fc9805fa2 --- /dev/null +++ b/Searching/Fibonacci Search/fibonacci_search.c @@ -0,0 +1,64 @@ + +#include + +int min(int x, int y) { return (x<=y)? x : y; } + +int fibMonaccianSearch(int arr[], int x, int n) +{ + int fibMMm2 = 0; + int fibMMm1 = 1; + int fibM = fibMMm2 + fibMMm1; + + while (fibM < n) + { + fibMMm2 = fibMMm1; + fibMMm1 = fibM; + fibM = fibMMm2 + fibMMm1; + } + + + int offset = -1; + + + while (fibM > 1) + { + + int i = min(offset+fibMMm2, n-1); + + + if (arr[i] < x) + { + fibM = fibMMm1; + fibMMm1 = fibMMm2; + fibMMm2 = fibM - fibMMm1; + offset = i; + } + + else if (arr[i] > x) + { + fibM = fibMMm2; + fibMMm1 = fibMMm1 - fibMMm2; + fibMMm2 = fibM - fibMMm1; + } + + + else return i; + } + + if(fibMMm1 && arr[offset+1]==x)return offset+1; + + + return -1; +} + + +int main(void) +{ + int arr[] = {10, 22, 35, 40, 45, 50, 80, 82, + 85, 90, 100}; + int n = sizeof(arr)/sizeof(arr[0]); + int x = 85; + printf("Found at index: %d", + fibMonaccianSearch(arr, x, n)); + return 0; +} From bbeafcf655b7cab4f4d13022733b2c887c4ca1e5 Mon Sep 17 00:00:00 2001 From: Chinmay-KB Date: Sat, 27 Oct 2018 17:25:24 +0530 Subject: [PATCH 116/333] Java implementation of Secant method added --- .../secant_method/Java/Secant Method.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Numerical Methods/secant_method/Java/Secant Method.java diff --git a/Numerical Methods/secant_method/Java/Secant Method.java b/Numerical Methods/secant_method/Java/Secant Method.java new file mode 100644 index 000000000..45f5deab1 --- /dev/null +++ b/Numerical Methods/secant_method/Java/Secant Method.java @@ -0,0 +1,72 @@ + Java Program to find root of an + equations using secant method +class GFG { + + function takes value of x and + returns f(x) + static float f(float x) { + + we are taking equation + as x^3+x-1 + float f = (float)Math.pow(x, 3) + + x - 1; + + return f; + } + + static void secant(float x1, float x2, + float E) { + + float n = 0, xm, x0, c; + if (f(x1) f(x2) 0) + { + do { + + calculate the intermediate + value + x0 = (x1 f(x2) - x2 f(x1)) + (f(x2) - f(x1)); + + check if x0 is root of + equation or not + c = f(x1) f(x0); + + update the value of interval + x1 = x2; + x2 = x0; + + update number of iteration + n++; + + if x0 is the root of equation + then break the loop + if (c == 0) + break; + xm = (x1 f(x2) - x2 f(x1)) + (f(x2) - f(x1)); + + repeat the loop until the + convergence + } while (Math.abs(xm - x0) = E); + + System.out.println(Root of the + + given equation= + x0); + + System.out.println(No. of + + iterations = + n); + } + + else + System.out.print(Can not find a + + root in the given inteval); + } + + Driver code + public static void main(String[] args) { + + initializing the values + float x1 = 0, x2 = 1, E = 0.0001f; + secant(x1, x2, E); + } +} + \ No newline at end of file From 049f41d1e0ffaf981f8bd20a2a9d623934306720 Mon Sep 17 00:00:00 2001 From: Amit Sarkar Date: Sat, 27 Oct 2018 18:27:55 +0530 Subject: [PATCH 117/333] Added Segment Tree --- .../cpp/Inversion Count Segment tree.cpp | 56 ++++++++++++++++ .../cpp/Segment Tree Lazy Propagation.cpp | 67 +++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 Tree/segment tree/cpp/Inversion Count Segment tree.cpp create mode 100644 Tree/segment tree/cpp/Segment Tree Lazy Propagation.cpp diff --git a/Tree/segment tree/cpp/Inversion Count Segment tree.cpp b/Tree/segment tree/cpp/Inversion Count Segment tree.cpp new file mode 100644 index 000000000..b3738cc39 --- /dev/null +++ b/Tree/segment tree/cpp/Inversion Count Segment tree.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; +typedef long long int ll; +ll tree[800001],n,sum; +struct nud{ + ll val,id; +}a[200001]; +bool cmp(nud n1,nud n2) +{ + if(n1.val==n2.val) + return n1.id>n2.id; + return n1.val>n2.val; +} +void query(ll node,ll l,ll r,ll pos) +{ + if(l==r) + { + tree[node]++; + return; + } + ll mid=(l+r)/2; + if(pos<=mid) + { + query(2*node,l,mid,pos); + } + else{ + sum+=tree[2*node]; + query(2*node+1,mid+1,r,pos); + } + tree[node]=tree[2*node]+tree[2*node+1]; +} +int main() { + // your code goes here + ll t; + cin>>t; + while(t--) + { + ll n; + cin>>n; + ll i,j,k=0; + sum=0; + memset(tree,0,sizeof(tree)); + for(i=1;i<=n;i++) + { + cin>>a[i].val; + a[i].id=i; + } + sort(a+1,a+n+1,cmp); + for(i=1;i<=n;i++) + { + query(1,1,n,a[i].id); + } + cout< +using namespace std; +typedef long long int ll; +ll tree[400001],tree1[400001]; +void lazy(ll node,ll l,ll r) +{ + tree[node]+=tree1[node]*(r-l+1); + if(l==r) + { + tree1[node]=0; + return; + } + tree1[2*node]+=tree1[node]; + tree1[2*node+1]+=tree1[node]; + tree1[node]=0; +} +ll q0(ll node,ll l,ll r,ll l1,ll r1,ll val=0){ + //cout<>t; + while(t--) + { + ll n,m; + cin>>n>>m; + ll i,j,k; + memset(tree,0,sizeof(tree)); + memset(tree1,0,sizeof(tree1)); + while(m--) + { + ll x,p,q,v; + cin>>x; + if(x==0) + { + cin>>p>>q>>v; + q0(1,1,n,p,q,v); + } + else{ + cin>>p>>q; + cout< Date: Sat, 27 Oct 2018 19:34:57 +0530 Subject: [PATCH 118/333] Created divide and cpnquer folder and added closest pair algorithm in that folder --- Divide and Conquer /closest_points.py | 76 +++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Divide and Conquer /closest_points.py diff --git a/Divide and Conquer /closest_points.py b/Divide and Conquer /closest_points.py new file mode 100644 index 000000000..8189f3b37 --- /dev/null +++ b/Divide and Conquer /closest_points.py @@ -0,0 +1,76 @@ +import math + +# This program takes n points in a plane as input and returns the closest pair of points. The algorithm is based on divide +# and conquer paradigm. In this program, it is assumed that no two points have same x coordinates of same y coordinates (If not +# we can enforce this by slight rotation of plane) + + +# Function to find distance between two points +def dist(P1,P2): + x1,y1=P1 + x2,y2=P2 + return math.sqrt((x2-x1)**2 + (y2-y1)**2) + + +# This is trivial method to find distance between two points. We definitely will not divide plane when there will be only two or three +# vertices in a plane. So, in such cases distance will be found using brute force method +def brute_force(a): + m=10**10 + for i in range(len(a)): + for j in range(i+1,len(a)): + m=min(dist(a[i],a[j]),m) + return m + + +# This function finds the closest pair of points such that both the points lies in different parts of plane +# that is divided in two parts +def stripClosest(strip,d): + m=d + strip.sort(key=lambda t:t[1]) + + for i in range(len(strip)): + for j in range(i+1,len(strip)): + if strip[j][1]-strip[i][1] Date: Sat, 27 Oct 2018 19:44:04 +0530 Subject: [PATCH 119/333] Added test case in the comment below the program --- Divide and Conquer /closest_points.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Divide and Conquer /closest_points.py b/Divide and Conquer /closest_points.py index 8189f3b37..8957af6da 100644 --- a/Divide and Conquer /closest_points.py +++ b/Divide and Conquer /closest_points.py @@ -74,3 +74,13 @@ def closest(a): #sort the input array according to x coordinate a.sort() print closest(a) + + + +#----------Test Case------------# + +''' +{{2, 3}, {12, 30}, {40, 50}, {5, 1}, {12, 10}, {3, 4}} +This input gives 1.414214 output +''' + From 13b31fa99d0d0857024d25ee1bc82b3d8ccf1993 Mon Sep 17 00:00:00 2001 From: Adnan Alam Date: Sat, 27 Oct 2018 21:41:11 +0600 Subject: [PATCH 120/333] added Singly linked list in Python --- .../linked list/python/Singly-linked-list.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 data structures/linked list/python/Singly-linked-list.py diff --git a/data structures/linked list/python/Singly-linked-list.py b/data structures/linked list/python/Singly-linked-list.py new file mode 100644 index 000000000..a8f525867 --- /dev/null +++ b/data structures/linked list/python/Singly-linked-list.py @@ -0,0 +1,67 @@ +class Node: + def __init__(self,data,next_node=None): + self.data = data + self.next_node = next_node + + def get_data(self): + return self.data + + def get_next(self): + return self.next_node + + def set_next(self,new_node): + self.next_node = new_node + + +class Linked_list: + def __init__(self,head=None): + self.head = head + + def insert_head(self,data): + new_node = Node(data) + new_node.set_next(self.head) + self.head = new_node + + def insert_tail(self,data): + new_node = Node(data) + current = self.head + if current is None: + self.head = new_node + else: + while current.get_next(): + current = current.get_next() + current.set_next(new_node) + + def delete(self,data): + current = self.head + prev = None + while current: + if current.get_data() == data: + if prev: + prev.set_next(current.get_next()) + else: + self.head = current.get_next() + break + else: + prev = current + current = current.get_next() + + def search(self,data): + current = self.head + while current: + if current.get_data() == data: + return True + else: + current = current.get_next() + return False + + def print_list(self): + current = self.head + self.temp = [] + while current: + self.temp.append(current.get_data()) + current = current.get_next() + print(self.temp) + + def __len__(self): + return len(self.temp) From 965ac37d2b38855fcb3aa33cc54009e41bcebf93 Mon Sep 17 00:00:00 2001 From: Adnan Alam Date: Sat, 27 Oct 2018 21:43:16 +0600 Subject: [PATCH 121/333] added Stack data structure using Singly Linked List in Python --- .../python/Stack_with_Singly_Linked_List.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 data structures/linked list/python/Stack_with_Singly_Linked_List.py diff --git a/data structures/linked list/python/Stack_with_Singly_Linked_List.py b/data structures/linked list/python/Stack_with_Singly_Linked_List.py new file mode 100644 index 000000000..813c96b83 --- /dev/null +++ b/data structures/linked list/python/Stack_with_Singly_Linked_List.py @@ -0,0 +1,50 @@ +class Node: + def __init__(self,data=None,next_node=None): + self.data = data + self.next_node = next_node + + def get_data(self): + return self.data + + def get_next(self): + return self.next_node + + def set_next(self,new_node): + self.next_node = new_node + + +class Stack: + def __init__(self,head=None): + self.head = head + + def push(self,data): + new_item = Node(data) + current = self.head + if current is None: + self.head = new_item + else: + while current.get_next(): + current = current.get_next() + current.set_next(new_item) + + def pop(self): + current = self.head + prev = None + if current is not None: + while current.get_next(): + prev = current + current = current.get_next() + if prev: + prev.set_next(current.get_next()) + else: + self.head = current.get_next() + else: + print("Empty stack!") + + def print_stack(self): + current = self.head + temp = [] + while current: + temp.append(current.get_data()) + current = current.get_next() + return temp From b875f47b43733132fa33806188fac654f822e98c Mon Sep 17 00:00:00 2001 From: Adnan Alam Date: Sat, 27 Oct 2018 21:45:20 +0600 Subject: [PATCH 122/333] Queue data structure using Singly Linked List in Python --- .../python/Queue_with_Singly_Linked_List.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 data structures/linked list/python/Queue_with_Singly_Linked_List.py diff --git a/data structures/linked list/python/Queue_with_Singly_Linked_List.py b/data structures/linked list/python/Queue_with_Singly_Linked_List.py new file mode 100644 index 000000000..9d1002e6f --- /dev/null +++ b/data structures/linked list/python/Queue_with_Singly_Linked_List.py @@ -0,0 +1,57 @@ +class Node: + def __init__(self,data=None,next_node=None): + self.data = data + self.next_node = next_node + + def get_data(self): + return self.data + + def get_next(self): + return self.next_node + + def set_next(self,new_node): + self.next_node = new_node + + +class Queue: + def __init__(self,head=None): + self.head = head + + def enqueue(self,data): + new_item = Node(data) + current = self.head + if current is None: + self.head = new_item + else: + while current.get_next(): + current = current.get_next() + current.set_next(new_item) + + def dequeue(self): + current = self.head + if current != None: + self.head = current.get_next() + else: + print("Queue is empty") + + def size(self): + current = self.head + count = 0 + while current: + count +=1 + current = current.get_next() + return count + + def print_queue(self): + current = self.head + temp = [] + while current: + temp.append(current.get_data()) + current = current.get_next() + return temp + + def is_empty(self): + if self.head == None: + print("Queue is empty!") + else: + print("Queue isn't empty!") From 38ffd5a36f2dd606a59ea0bf400feef015c35f56 Mon Sep 17 00:00:00 2001 From: DianaBabenko <44234645+DianaBabenko@users.noreply.github.com> Date: Sat, 27 Oct 2018 19:05:33 +0300 Subject: [PATCH 123/333] Change th function of randome --- Random Number/random.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Random Number/random.js b/Random Number/random.js index 11d9ac2a1..ae0a0b97c 100644 --- a/Random Number/random.js +++ b/Random Number/random.js @@ -1,9 +1,13 @@ //La función genera un número aleatorio entre 1 y el número deseado +var number=5; +var A = []; +function getRandomInt(min,max){ + return Math.floor(Math.random() * (max - min + 1)) + min; +} -function numRandom (num) { - - return Math.floor((Math.random() * num) + 1); - +for (i = 0; i < number; i++){ + A[i] = getRandomInt(1,30); + console.log(A[i]); } -console.log(numRandom(5)); + From 988063c76dc61b01979be3623fca86fa7767d705 Mon Sep 17 00:00:00 2001 From: Hiago Fernandes Date: Sat, 27 Oct 2018 14:21:19 -0300 Subject: [PATCH 124/333] add algoritm permutation in c++ language --- Backtracking/Permutation/permuta.cpp | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Backtracking/Permutation/permuta.cpp diff --git a/Backtracking/Permutation/permuta.cpp b/Backtracking/Permutation/permuta.cpp new file mode 100644 index 000000000..5f85de59d --- /dev/null +++ b/Backtracking/Permutation/permuta.cpp @@ -0,0 +1,37 @@ +#include + +void troca(int vetor[], int i, int j) +{ + int aux = vetor[i]; + vetor[i] = vetor[j]; + vetor[j] = aux; +} + +void permuta(int vetor[], int inf, int sup) +{ + if(inf == sup) + { + for(int i = 0; i <= sup; i++) + printf("%d ", vetor[i]); + printf("\n"); + } + else + { + for(int i = inf; i <= sup; i++) + { + troca(vetor, inf, i); + permuta(vetor, inf + 1, sup); + troca(vetor, inf, i); + } + } +} + +int main(int argc, char *argv[]) +{ + int v[] = {1, 2, 3, 4}; + int tam_v = sizeof(v) / sizeof(int); + + permuta(v, 0, tam_v - 1); + + return 0; +} From 6ae7030227660222970148b282ccdfa9c69c9fde Mon Sep 17 00:00:00 2001 From: SmartySharma1997 <43146886+SmartySharma1997@users.noreply.github.com> Date: Sat, 27 Oct 2018 23:19:24 +0530 Subject: [PATCH 125/333] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94a031855..402c5a96b 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Clean example implementations of data structures and algorithms written in diffe * Graphical examples would be very helpful too. * Don't forget to include tests. * Don't remove previous implementations of algorithms. Just add a new file with your own implementation. - * Beautify and cleanup your code for easier reading + * Beautify and clean up your code for easier reading ## Resources - Curated list of resources dealing with algorithms. + The curated list of resources dealing with algorithms. * **Sites** * [Algorithms - Tutorials point](https://www.tutorialspoint.com/data_structures_algorithms/index.htm) From dde7e01d66627fcbc276185a56ac14e6caca2480 Mon Sep 17 00:00:00 2001 From: hasan356 Date: Sat, 27 Oct 2018 23:38:05 +0530 Subject: [PATCH 126/333] Added weighted job scheduling in dynamic programming --- .../WeightedJobScheduling/README.md | 8 +++ .../cpp/weighted_job_scheduling.cpp | 65 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 Dynamic Programming/WeightedJobScheduling/README.md create mode 100644 Dynamic Programming/WeightedJobScheduling/cpp/weighted_job_scheduling.cpp diff --git a/Dynamic Programming/WeightedJobScheduling/README.md b/Dynamic Programming/WeightedJobScheduling/README.md new file mode 100644 index 000000000..ecb2e2dac --- /dev/null +++ b/Dynamic Programming/WeightedJobScheduling/README.md @@ -0,0 +1,8 @@ +Problem: +Given N jobs where every job is represented by following three elements of it. + + Start Time + Finish Time + Profit or Value Associated + +Find the maximum profit subset of jobs such that no two jobs in the subset overlap. \ No newline at end of file diff --git a/Dynamic Programming/WeightedJobScheduling/cpp/weighted_job_scheduling.cpp b/Dynamic Programming/WeightedJobScheduling/cpp/weighted_job_scheduling.cpp new file mode 100644 index 000000000..dfaf04676 --- /dev/null +++ b/Dynamic Programming/WeightedJobScheduling/cpp/weighted_job_scheduling.cpp @@ -0,0 +1,65 @@ +#include +using namespace std; + +struct Job +{ + int start, finish, profit; +}jobs[100005]; + + +bool comp(Job a, Job b) +{ + return a.finish < b.finish; +} + +int binarySearch(int index) +{ + int l= 0, h = index - 1; + int ans = -1; + while (l<=h) + { + int m = (l+h)/2; + if (jobs[m].finish <= jobs[index].start) + { + ans = m; + l = m+1; + } + else + h = m-1; + } + return ans; +} + +//Main function which computes optimal profit +int weighted_job(int n) +{ + + sort(jobs, jobs+n, comp); + + int dp[n]; + + dp[0] = jobs[0].profit; + + for (int i=1; i>n; + //Enter the jobs start time,finish time and profit of the job. + for(int i = 0;i>jobs[i].start>>jobs[i].finish>>jobs[i].profit; + } + cout<<"Maximum profit will be "< Date: Sat, 27 Oct 2018 15:25:10 -0300 Subject: [PATCH 127/333] Create union-find.cpp --- Graphs/disjoint-sets/union-find.cpp | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Graphs/disjoint-sets/union-find.cpp diff --git a/Graphs/disjoint-sets/union-find.cpp b/Graphs/disjoint-sets/union-find.cpp new file mode 100644 index 000000000..ff26ac5a6 --- /dev/null +++ b/Graphs/disjoint-sets/union-find.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; + +#define SizeNodes 10 +#define INF 1e8 + +vector adj[SizeNodes]; +int id[SizeNodes], size[SizeNodes]; + +void init(int i){ + id[i] = i; + size[i] = 1; +} + +int find(int i){ + if(id[i] == i) return i; + return id[i] = find(id[i]); +} + +void unionSet(int a, int b){ + a = find(a); + b = find(b); + + if(a == b) return; + + if(size[a] > size[b]) swap(a, b); + + id[a] = b; + size[b] += size[a]; +} + +int main(){ + for(int i = 0; i < SizeNodes; i++) + init(i); + + unionSet(1, 3); + unionSet(3, 7); + + unionSet(0, 5); + + cout << find(7) << " " << find(0) << endl; + +return 0; +} From 398c3abed4f38d1a90aa68afad0f2f95df97aab0 Mon Sep 17 00:00:00 2001 From: Gautham Lal Date: Sun, 28 Oct 2018 00:07:20 +0530 Subject: [PATCH 128/333] Added Bubble Sort implementation for Julia --- Sorting/Bubble Sort/Julia/bubble-sort.jl | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Sorting/Bubble Sort/Julia/bubble-sort.jl diff --git a/Sorting/Bubble Sort/Julia/bubble-sort.jl b/Sorting/Bubble Sort/Julia/bubble-sort.jl new file mode 100644 index 000000000..95b39f2bd --- /dev/null +++ b/Sorting/Bubble Sort/Julia/bubble-sort.jl @@ -0,0 +1,28 @@ +# Bubble Sort is the simplest sorting algorithm that works by +# repeatedly swapping the adjacent elements if they are in wrong order. + +function swap!{T}(x::AbstractArray{T}, a::T, b::T) + + tmp = x[a] + x[a] = x[b] + x[b] = tmp + return x + +end + +function bubblesort!{T}(x::AbstractArray{T}) + + for i in 2:length(x) + for j in 1:length(x)-1 + if x[j] > x[j+1] + swap!(x, j, j+1) + end + end + end + + return x +end + +x = [10,2,5,1,3,0] + +println(bubblesort!(x)) \ No newline at end of file From 70bef0c39f2751f62efe92b6bdbe6de92b39fb9a Mon Sep 17 00:00:00 2001 From: Gajesh Date: Sun, 28 Oct 2018 00:56:14 +0530 Subject: [PATCH 129/333] Fibonacci of number using matrix multiplication --- Mathematics/fibonacci/cpp/a.exe | Bin 0 -> 463987 bytes Mathematics/fibonacci/cpp/matrix_fibo.cpp | 60 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 Mathematics/fibonacci/cpp/a.exe create mode 100644 Mathematics/fibonacci/cpp/matrix_fibo.cpp diff --git a/Mathematics/fibonacci/cpp/a.exe b/Mathematics/fibonacci/cpp/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..e6be7c17d8043edc9636790e0fb6f883d42a6514 GIT binary patch literal 463987 zcmeFa4}4VBnLm8zPr?KSW`F<@qC^dr5wwY-l7eNDFd-_DNya4jCyEv#vZ54c0F_BX zZ)VNmIySotTWw`4+qz|c)h+Ep7ll9)CVQ>FIC$!bIl5mM&;KIhy!b0>h> z?z_9c_w#wfhq?Ejd;UDm#HsX>VS+%{2GTEALwT$P-!1mOuXR@&}h@eec1?9(&xM_0XcM<$=et9(gQl_B>zK z(#IDrx_kYUX{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