diff --git a/3sum.cpp b/Algebra-and-Numerical-Methods/cpp/3sum.cpp similarity index 100% rename from 3sum.cpp rename to Algebra-and-Numerical-Methods/cpp/3sum.cpp diff --git a/Algebra-and-Numerical-Methods/IntegerFactorizeAlgo.cpp b/Algebra-and-Numerical-Methods/cpp/IntegerFactorizeAlgo.cpp similarity index 100% rename from Algebra-and-Numerical-Methods/IntegerFactorizeAlgo.cpp rename to Algebra-and-Numerical-Methods/cpp/IntegerFactorizeAlgo.cpp diff --git a/Algebra-and-Numerical-Methods/SieveOfEratosthenes.cpp b/Algebra-and-Numerical-Methods/cpp/SieveOfEratosthenes.cpp similarity index 100% rename from Algebra-and-Numerical-Methods/SieveOfEratosthenes.cpp rename to Algebra-and-Numerical-Methods/cpp/SieveOfEratosthenes.cpp diff --git a/logarithmic_power.cpp b/Algebra-and-Numerical-Methods/cpp/logarithmic_power.cpp similarity index 100% rename from logarithmic_power.cpp rename to Algebra-and-Numerical-Methods/cpp/logarithmic_power.cpp diff --git a/Fractional_Knapsack.cpp b/Algorithms/cpp/Fractional_Knapsack.cpp similarity index 100% rename from Fractional_Knapsack.cpp rename to Algorithms/cpp/Fractional_Knapsack.cpp diff --git a/Lees_algo.cpp b/Algorithms/cpp/Lees_algo.cpp similarity index 98% rename from Lees_algo.cpp rename to Algorithms/cpp/Lees_algo.cpp index 662f92d..e135b22 100644 --- a/Lees_algo.cpp +++ b/Algorithms/cpp/Lees_algo.cpp @@ -33,7 +33,7 @@ bool isValid(int mat[][N], bool visited[][N], int row, int col) void BFS(int mat[][N], int i, int j, int x, int y)// BFS algorithm { - bool visited[M][N] + bool visited[M][N]; memset(visited, false, sizeof visited); queue q; diff --git a/Data-Structures/Hashing.c b/Data-Structures/c/Hashing.c similarity index 100% rename from Data-Structures/Hashing.c rename to Data-Structures/c/Hashing.c diff --git a/Data-Structures/BalancedBrackets.cpp b/Data-Structures/cpp/BalancedBrackets.cpp similarity index 100% rename from Data-Structures/BalancedBrackets.cpp rename to Data-Structures/cpp/BalancedBrackets.cpp diff --git a/Data-Structures/SquareRootDecompostion.cpp b/Data-Structures/cpp/SquareRootDecompostion.cpp similarity index 100% rename from Data-Structures/SquareRootDecompostion.cpp rename to Data-Structures/cpp/SquareRootDecompostion.cpp diff --git a/Dynamic-Programming/KadanesAlgo.cpp b/Dynamic-Programming/cpp/KadanesAlgo.cpp similarity index 100% rename from Dynamic-Programming/KadanesAlgo.cpp rename to Dynamic-Programming/cpp/KadanesAlgo.cpp diff --git a/Graphs/DFS.cpp b/Graphs/cpp/DFS.cpp similarity index 100% rename from Graphs/DFS.cpp rename to Graphs/cpp/DFS.cpp diff --git a/Graphs/HeightOfBinaryTree.cpp b/Graphs/cpp/HeightOfBinaryTree.cpp similarity index 100% rename from Graphs/HeightOfBinaryTree.cpp rename to Graphs/cpp/HeightOfBinaryTree.cpp diff --git a/linear_search.c b/Searching/c/linear_search.c similarity index 100% rename from linear_search.c rename to Searching/c/linear_search.c diff --git a/Searching/BinarySearchIterative.cpp b/Searching/cpp/BinarySearchIterative.cpp similarity index 100% rename from Searching/BinarySearchIterative.cpp rename to Searching/cpp/BinarySearchIterative.cpp diff --git a/Searching/BinarySearchRecursion.cpp b/Searching/cpp/BinarySearchRecursion.cpp similarity index 100% rename from Searching/BinarySearchRecursion.cpp rename to Searching/cpp/BinarySearchRecursion.cpp diff --git a/Searching/LinearSearch.cpp b/Searching/cpp/LinearSearch.cpp similarity index 100% rename from Searching/LinearSearch.cpp rename to Searching/cpp/LinearSearch.cpp diff --git a/breadth_first_search.cpp b/Searching/cpp/breadth_first_search.cpp similarity index 100% rename from breadth_first_search.cpp rename to Searching/cpp/breadth_first_search.cpp diff --git a/Searching/python/linear_search.py b/Searching/python/linear_search.py new file mode 100644 index 0000000..7da1674 --- /dev/null +++ b/Searching/python/linear_search.py @@ -0,0 +1,15 @@ +def linear_search(arr, key): + found = False + for i in range(0,len(arr)): + if arr[i] == key: + print("Element Found at position {}".format(i+1)) + found = True + if found == False: + print("Element NOT Found") + + +# Driver Code + +arr = [2,4,5,6,7,2] +linear_search(arr,2) +linear_search(arr,10) diff --git a/Sorting/BubbleSort.cpp b/Sorting/cpp/BubbleSort.cpp similarity index 100% rename from Sorting/BubbleSort.cpp rename to Sorting/cpp/BubbleSort.cpp diff --git a/Sorting/MergeSort.cpp b/Sorting/cpp/MergeSort.cpp similarity index 100% rename from Sorting/MergeSort.cpp rename to Sorting/cpp/MergeSort.cpp diff --git a/Sorting/QuickSort.cpp b/Sorting/cpp/QuickSort.cpp similarity index 100% rename from Sorting/QuickSort.cpp rename to Sorting/cpp/QuickSort.cpp diff --git a/Selection_Sort.cpp b/Sorting/cpp/Selection_Sort.cpp similarity index 100% rename from Selection_Sort.cpp rename to Sorting/cpp/Selection_Sort.cpp diff --git a/bucket_sort.cpp b/Sorting/cpp/bucket_sort.cpp similarity index 100% rename from bucket_sort.cpp rename to Sorting/cpp/bucket_sort.cpp