From c81d0932416d2c135a7263b8288b3c598f9631f8 Mon Sep 17 00:00:00 2001 From: ZhenXW77 Date: Sun, 30 Jan 2022 22:09:02 -0500 Subject: [PATCH] Organization and Cocktail Sort I organize most of the .cpp files, deleted duplicates and add cocktail sorting algorithm. --- .../Array_Stack.cpp | 0 .../Find second maximum element in array | 0 .../Left rotate an array k times.cpp | 0 .../MaximumCircularSubarraySum.cpp | 0 .../NumberSmallerThanANumberInArray.cpp | 0 .../Print the array in spiral form | 0 .../Queue implementation using Array.cpp | 0 .../Reverse an array.cpp | 0 .../Shortest Subarray with Sum at least K.cpp | 0 .../Span of an Array | 0 .../circular_queue_using_array.cpp | 0 .../find_span_of_an_array.cpp | 0 .../first missing.cpp | 0 .../kadanealgorithm.cpp | 0 .../largest_subarray_with_zero_sum.cpp | 0 .../lonelyElement.cpp | 0 ...gestSubarray_with_equal_ones_and_zeros.cpp | 0 .../median_element_of_an_array.cpp | 0 .../median_of_an_array.cpp | 0 .../merge_k_sorted_arrays.cpp | 0 ...er of swaps required to sort the array.cpp | 0 repeat.cpp => Array Related/repeat.cpp | 0 .../stack_using_array.cpp | 0 .../Backtracking | 0 .../Rat In A Maze.cpp | 0 ...h the n'th stair - dynamic programming.cpp | 0 .../Kadane's Algorithm via different method | 0 .../dynamic_coin_change.cpp | 0 rodcut.cpp => Dynamic Programming/rodcut.cpp | 0 .../Encryption/HuffmanCoding.cpp | 0 .../Encryption/hash_table.cpp | 0 .../Clockwise_rotation _of_Linked_List.cpp | 0 ...elete_element_from_circular_linkedlist.cpp | 0 .../Detect_Loop_in_Singly_linkedlist.cpp | 0 .../DoublyLinkedlist.cpp | 0 .../Find length circular linked list.cpp | 0 .../FrequencyOfNumberInLinkedList.cpp | 0 .../LinkedListMiddle.cpp | 0 .../Merge two unsorted linked list | 0 ...th node from end in singly linked list.cpp | 0 .../Reverse Linked List | 0 .../SinglyLinkedList.cpp | 0 .../SinglyLinkedListIsPalidrome.cpp | 0 XORlist.cpp => LinkedList Related/XORlist.cpp | 0 .../all_operations_doublyLinkedList | 0 .../binaryLLtoDecimal.cpp | 0 .../double_circular_linkedlist.cpp | 0 .../searchelementincircularLL.cpp | 0 .../skiplist.cpp | 0 ...tionWithoutUsingMultiplicationOperator.cpp | 0 ...iplication-without-multiplication_operator | 0 .../number Related/ Operations/power.cpp | 0 .../ Operations/power_of_2.cpp | 0 .../ Operations/remainder-without-modulo.cpp | 0 .../number Related/ Operations/simpleSum.cpp | 0 .../number Related/ Operations/sqrt.cpp | 0 .../number Related/BleakNumber.cpp | 0 .../number Related/CalculatorInC++.c++ | 0 .../Functions/eular_totient.cpp | 0 GCD.cpp => Math/number Related/GCD.cpp | 0 .../number Related/Happy_Number.cpp | 0 .../number Related/HelpfulMaths.cpp | 0 .../number Related/LargestEvenNumber.cpp | 0 .../number Related/NewtonRaphsonAlgo.cpp | 0 .../number Related/Pascals_triangle.cpp | 0 .../number Related/Rotate_number_by_k.cpp | 0 .../SeparateEvenAndOddNumbers.cpp | 0 .../Series/CalculateTheGivenSeries.cpp | 0 .../Series/TaylorSeriesByHorner'sRule.cpp | 0 .../number Related/SubsetSum.cpp | 0 .../number Related/SwapTwoNibbles.cpp | 0 .../number Related/Three_Sum.cpp | 0 .../number Related/Trailing zeroes.cpp | 0 .../number Related/Two_Sum.cpp | 0 .../number Related/factorial.cpp | 0 .../number Related/fibonacci_xor.cpp | 0 .../number Related/finding a perfect number | 0 .../number Related/longest_subsequence.cpp | 0 nCr.cpp => Math/number Related/nCr.cpp | 0 .../number Related/ntUglyNumber | 0 .../number Related/nth_catalan.cpp | 0 .../number Related/palindrome1.cpp | 0 .../number Related/perfectnums.cpp | 0 .../number Related/prime_factorisation.cpp | 0 .../number Related/sieveOfEratosthenes.cpp | 0 .../number Related/square_root.cpp | 0 .../Binary Matrix.cpp | 0 .../MatrixChainMultiplication.cpp | 0 .../Rotate_matrixby90deg.c | 0 .../Sparse Matrix/SparseMatricesAdd.cpp | 0 .../Sparse Matrix/matrix_to_sparse.cpp | 0 .../Sparse Matrix}/sparse matrix.cpp | 0 .../Spiral traversal of matrix | 0 .../SpiralOdereMatrixTraversal.cpp | 0 .../Strassen\342\200\231s Algorithm.cpp" | 0 ...or representation of genreal sparse Matrix | 0 .../fibonacciNumberUsingMatrix.cpp | 0 .../fibonacciNumberUsingMatrix.exe | Bin .../matrix multiplication.cpp | 0 .../494-Target_sum-Leetcode-DP.cpp | 0 .../Abhinav_LongestAP.cpp | 0 .../Best_time_to_buy_stock_and_sell.cpp | 0 CG2.cpp => Miscellaneous/CG2.cpp | 0 .../Check Balanced Paranthesis.cpp | 0 .../Coins_Denomination.cpp | 0 .../GoldMineProblem.cpp | 0 .../MinTimeVisitPoints.cpp | 0 Minimax.cpp => Miscellaneous/Minimax.cpp | 0 .../Minimum_Path_Sum.cpp | 0 .../Peak Element.cpp | 0 .../PotsOfGold.cpp | 0 .../SmallerThanCurrent.cpp | 0 .../activity_selection.cpp | 0 .../bankers_algorithm_safe_state.cpp | 0 .../count_connected_components.cpp | 0 linedraw.cpp => Miscellaneous/linedraw.cpp | 0 .../minimum_swaps_to_sort_shanti16r.cpp | 0 .../optimalStratergy.cpp | 0 .../Longest_Palindromic_Subsequence.cpp | 0 .../StringPalindrome.cpp | 0 ...ck_if_number_is_palindrome_Scientist69.cpp | 0 ...umber_is_palindrome_or_not_Scientist69.cpp | 0 .../FIBONACCI _RECURSION.CPP | 0 .../Josephus Problem | 0 .../Longest_Common_Subsequence.cpp | 0 .../Program for fabonacci using recursion | 0 .../josephusProblem.cpp | 0 .../KMP_ALGORITHM.cpp | 0 .../boyer_moore_horspool.cpp | 0 dis.cpp => SearchingAlgorithms/dis.cpp | 0 .../linear_search.cpp | 0 ShellSort.cpp | 52 --------- SortingAlgorithms/Cocktail_Sort.cpp | 107 ++++++++++++++++++ .../SortInWaveForm.cpp | 0 .../radix_sort_using_counting_sort.cpp | 0 .../Interleaving_string.cpp | 0 .../Next_Similar_Number.cpp | 0 .../Rabin_Karp_Algorithm.cpp | 0 WordBreak.cpp => String Related/WordBreak.cpp | 0 .../Towerofhanoi_usingStack.cpp | 0 .../towerofhanoi.cpp | 0 .../Disjoint/DSU_implementation.cpp | 0 .../Disjoint/Equal_Sum_Partition.cpp | 0 Fenwick_Tree.cpp => Trees/Fenwick_Tree.cpp | 0 Segment_tree.cpp => Trees/Segment_tree.cpp | 0 .../Sum of all nodes value of Binary Tree.cpp | 0 Trees/{ => Traversal}/inorder_traversal.cpp | 0 .../level_order_traversal-using-queue.cpp | 0 .../{ => Traversal}/level_order_traversal.cpp | 0 .../Traversal/postorder_traversal.cpp | 0 .../Traversal/preorder_traversal.cpp | 0 .../Traversal/shwetankInorderTraversal.cpp | 0 .../lazySegmentTree.cpp | 0 rangeMin.cpp => Trees/rangeMin.cpp | 0 count_sort.cpp | 52 --------- countingsort_negative.cpp | 67 ----------- merge_sort.cpp | 58 ---------- selection_sort.cpp | 34 ------ tim sort.cpp | 94 --------------- 159 files changed, 107 insertions(+), 357 deletions(-) rename Array_Stack.cpp => Array Related/Array_Stack.cpp (100%) rename Find second maximum element in array => Array Related/Find second maximum element in array (100%) rename Left rotate an array k times.cpp => Array Related/Left rotate an array k times.cpp (100%) rename MaximumCircularSubarraySum.cpp => Array Related/MaximumCircularSubarraySum.cpp (100%) rename NumberSmallerThanANumberInArray.cpp => Array Related/NumberSmallerThanANumberInArray.cpp (100%) rename Print the array in spiral form => Array Related/Print the array in spiral form (100%) rename Queue implementation using Array.cpp => Array Related/Queue implementation using Array.cpp (100%) rename Reverse an array.cpp => Array Related/Reverse an array.cpp (100%) rename Shortest Subarray with Sum at least K.cpp => Array Related/Shortest Subarray with Sum at least K.cpp (100%) rename Span of an Array => Array Related/Span of an Array (100%) rename circular_queue_using_array.cpp => Array Related/circular_queue_using_array.cpp (100%) rename find_span_of_an_array.cpp => Array Related/find_span_of_an_array.cpp (100%) rename first missing.cpp => Array Related/first missing.cpp (100%) rename kadanealgorithm.cpp => Array Related/kadanealgorithm.cpp (100%) rename largest_subarray_with_zero_sum.cpp => Array Related/largest_subarray_with_zero_sum.cpp (100%) rename lonelyElement.cpp => Array Related/lonelyElement.cpp (100%) rename longestSubarray_with_equal_ones_and_zeros.cpp => Array Related/longestSubarray_with_equal_ones_and_zeros.cpp (100%) rename median_element_of_an_array.cpp => Array Related/median_element_of_an_array.cpp (100%) rename median_of_an_array.cpp => Array Related/median_of_an_array.cpp (100%) rename merge_k_sorted_arrays.cpp => Array Related/merge_k_sorted_arrays.cpp (100%) rename minimum number of swaps required to sort the array.cpp => Array Related/minimum number of swaps required to sort the array.cpp (100%) rename repeat.cpp => Array Related/repeat.cpp (100%) rename stack_using_array.cpp => Array Related/stack_using_array.cpp (100%) rename Backtracking => Backtracking Related/Backtracking (100%) rename Rat In A Maze.cpp => Backtracking Related/Rat In A Maze.cpp (100%) rename Count ways to reach the n'th stair - dynamic programming.cpp => Dynamic Programming/Count ways to reach the n'th stair - dynamic programming.cpp (100%) rename Kadane's Algorithm via different method => Dynamic Programming/Kadane's Algorithm via different method (100%) rename dynamic_coin_change.cpp => Dynamic Programming/dynamic_coin_change.cpp (100%) rename rodcut.cpp => Dynamic Programming/rodcut.cpp (100%) rename HuffmanCoding.cpp => Hashing/Encryption/HuffmanCoding.cpp (100%) rename hash_table.cpp => Hashing/Encryption/hash_table.cpp (100%) rename Clockwise_rotation _of_Linked_List.cpp => LinkedList Related/Clockwise_rotation _of_Linked_List.cpp (100%) rename Delete_element_from_circular_linkedlist.cpp => LinkedList Related/Delete_element_from_circular_linkedlist.cpp (100%) rename Detect_Loop_in_Singly_linkedlist.cpp => LinkedList Related/Detect_Loop_in_Singly_linkedlist.cpp (100%) rename DoublyLinkedlist.cpp => LinkedList Related/DoublyLinkedlist.cpp (100%) rename Find length circular linked list.cpp => LinkedList Related/Find length circular linked list.cpp (100%) rename FrequencyOfNumberInLinkedList.cpp => LinkedList Related/FrequencyOfNumberInLinkedList.cpp (100%) rename LinkedListMiddle.cpp => LinkedList Related/LinkedListMiddle.cpp (100%) rename Merge two unsorted linked list => LinkedList Related/Merge two unsorted linked list (100%) rename Print Nth node from end in singly linked list.cpp => LinkedList Related/Print Nth node from end in singly linked list.cpp (100%) rename Reverse Linked List => LinkedList Related/Reverse Linked List (100%) rename SinglyLinkedList.cpp => LinkedList Related/SinglyLinkedList.cpp (100%) rename SinglyLinkedListIsPalidrome.cpp => LinkedList Related/SinglyLinkedListIsPalidrome.cpp (100%) rename XORlist.cpp => LinkedList Related/XORlist.cpp (100%) rename all_operations_doublyLinkedList => LinkedList Related/all_operations_doublyLinkedList (100%) rename binaryLLtoDecimal.cpp => LinkedList Related/binaryLLtoDecimal.cpp (100%) rename double_circular_linkedlist.cpp => LinkedList Related/double_circular_linkedlist.cpp (100%) rename searchelementincircularLL.cpp => LinkedList Related/searchelementincircularLL.cpp (100%) rename skiplist.cpp => LinkedList Related/skiplist.cpp (100%) rename MultiplicationWithoutUsingMultiplicationOperator.cpp => Math/number Related/ Operations/MultiplicationWithoutUsingMultiplicationOperator.cpp (100%) rename multiplication-without-multiplication_operator => Math/number Related/ Operations/multiplication-without-multiplication_operator (100%) rename power.cpp => Math/number Related/ Operations/power.cpp (100%) rename power_of_2.cpp => Math/number Related/ Operations/power_of_2.cpp (100%) rename remainder-without-modulo.cpp => Math/number Related/ Operations/remainder-without-modulo.cpp (100%) rename simpleSum.cpp => Math/number Related/ Operations/simpleSum.cpp (100%) rename sqrt.cpp => Math/number Related/ Operations/sqrt.cpp (100%) rename BleakNumber.cpp => Math/number Related/BleakNumber.cpp (100%) rename CalculatorInC++.c++ => Math/number Related/CalculatorInC++.c++ (100%) rename eular_totient.cpp => Math/number Related/Functions/eular_totient.cpp (100%) rename GCD.cpp => Math/number Related/GCD.cpp (100%) rename Happy_Number.cpp => Math/number Related/Happy_Number.cpp (100%) rename HelpfulMaths.cpp => Math/number Related/HelpfulMaths.cpp (100%) rename LargestEvenNumber.cpp => Math/number Related/LargestEvenNumber.cpp (100%) rename NewtonRaphsonAlgo.cpp => Math/number Related/NewtonRaphsonAlgo.cpp (100%) rename Pascals_triangle.cpp => Math/number Related/Pascals_triangle.cpp (100%) rename Rotate_number_by_k.cpp => Math/number Related/Rotate_number_by_k.cpp (100%) rename SeparateEvenAndOddNumbers.cpp => Math/number Related/SeparateEvenAndOddNumbers.cpp (100%) rename CalculateTheGivenSeries.cpp => Math/number Related/Series/CalculateTheGivenSeries.cpp (100%) rename TaylorSeriesByHorner'sRule.cpp => Math/number Related/Series/TaylorSeriesByHorner'sRule.cpp (100%) rename SubsetSum.cpp => Math/number Related/SubsetSum.cpp (100%) rename SwapTwoNibbles.cpp => Math/number Related/SwapTwoNibbles.cpp (100%) rename Three_Sum.cpp => Math/number Related/Three_Sum.cpp (100%) rename Trailing zeroes.cpp => Math/number Related/Trailing zeroes.cpp (100%) rename Two_Sum.cpp => Math/number Related/Two_Sum.cpp (100%) rename factorial.cpp => Math/number Related/factorial.cpp (100%) rename fibonacci_xor.cpp => Math/number Related/fibonacci_xor.cpp (100%) rename finding a perfect number => Math/number Related/finding a perfect number (100%) rename longest_subsequence.cpp => Math/number Related/longest_subsequence.cpp (100%) rename nCr.cpp => Math/number Related/nCr.cpp (100%) rename ntUglyNumber => Math/number Related/ntUglyNumber (100%) rename nth_catalan.cpp => Math/number Related/nth_catalan.cpp (100%) rename palindrome1.cpp => Math/number Related/palindrome1.cpp (100%) rename perfectnums.cpp => Math/number Related/perfectnums.cpp (100%) rename prime_factorisation.cpp => Math/number Related/prime_factorisation.cpp (100%) rename sieveOfEratosthenes.cpp => Math/number Related/sieveOfEratosthenes.cpp (100%) rename square_root.cpp => Math/number Related/square_root.cpp (100%) rename Binary Matrix.cpp => Matrix Related/Binary Matrix.cpp (100%) rename MatrixChainMultiplication.cpp => Matrix Related/MatrixChainMultiplication.cpp (100%) rename Rotate_matrixby90deg.c => Matrix Related/Rotate_matrixby90deg.c (100%) rename SparseMatricesAdd.cpp => Matrix Related/Sparse Matrix/SparseMatricesAdd.cpp (100%) rename matrix_to_sparse.cpp => Matrix Related/Sparse Matrix/matrix_to_sparse.cpp (100%) rename {Sparse Matrix => Matrix Related/Sparse Matrix}/sparse matrix.cpp (100%) rename Spiral traversal of matrix => Matrix Related/Spiral traversal of matrix (100%) rename SpiralOdereMatrixTraversal.cpp => Matrix Related/SpiralOdereMatrixTraversal.cpp (100%) rename "Strassen\342\200\231s Algorithm.cpp" => "Matrix Related/Strassen\342\200\231s Algorithm.cpp" (100%) rename Vector representation of genreal sparse Matrix => Matrix Related/Vector representation of genreal sparse Matrix (100%) rename fibonacciNumberUsingMatrix.cpp => Matrix Related/fibonacciNumberUsingMatrix.cpp (100%) rename fibonacciNumberUsingMatrix.exe => Matrix Related/fibonacciNumberUsingMatrix.exe (100%) rename matrix multiplication.cpp => Matrix Related/matrix multiplication.cpp (100%) rename 494-Target_sum-Leetcode-DP.cpp => Miscellaneous/494-Target_sum-Leetcode-DP.cpp (100%) rename Abhinav_LongestAP.cpp => Miscellaneous/Abhinav_LongestAP.cpp (100%) rename Best_time_to_buy_stock_and_sell.cpp => Miscellaneous/Best_time_to_buy_stock_and_sell.cpp (100%) rename CG2.cpp => Miscellaneous/CG2.cpp (100%) rename Check Balanced Paranthesis.cpp => Miscellaneous/Check Balanced Paranthesis.cpp (100%) rename Coins_Denomination.cpp => Miscellaneous/Coins_Denomination.cpp (100%) rename GoldMineProblem.cpp => Miscellaneous/GoldMineProblem.cpp (100%) rename MinTimeVisitPoints.cpp => Miscellaneous/MinTimeVisitPoints.cpp (100%) rename Minimax.cpp => Miscellaneous/Minimax.cpp (100%) rename Minimum_Path_Sum.cpp => Miscellaneous/Minimum_Path_Sum.cpp (100%) rename Peak Element.cpp => Miscellaneous/Peak Element.cpp (100%) rename PotsOfGold.cpp => Miscellaneous/PotsOfGold.cpp (100%) rename SmallerThanCurrent.cpp => Miscellaneous/SmallerThanCurrent.cpp (100%) rename activity_selection.cpp => Miscellaneous/activity_selection.cpp (100%) rename bankers_algorithm_safe_state.cpp => Miscellaneous/bankers_algorithm_safe_state.cpp (100%) rename count_connected_components.cpp => Miscellaneous/count_connected_components.cpp (100%) rename linedraw.cpp => Miscellaneous/linedraw.cpp (100%) rename minimum_swaps_to_sort_shanti16r.cpp => Miscellaneous/minimum_swaps_to_sort_shanti16r.cpp (100%) rename optimalStratergy.cpp => Miscellaneous/optimalStratergy.cpp (100%) rename Longest_Palindromic_Subsequence.cpp => Palindrome Related/Longest_Palindromic_Subsequence.cpp (100%) rename StringPalindrome.cpp => Palindrome Related/StringPalindrome.cpp (100%) rename check_if_number_is_palindrome_Scientist69.cpp => Palindrome Related/check_if_number_is_palindrome_Scientist69.cpp (100%) rename check_whether_number_is_palindrome_or_not_Scientist69.cpp => Palindrome Related/check_whether_number_is_palindrome_or_not_Scientist69.cpp (100%) rename FIBONACCI _RECURSION.CPP => Recursion/FIBONACCI _RECURSION.CPP (100%) rename Josephus Problem => Recursion/Josephus Problem (100%) rename Longest_Common_Subsequence.cpp => Recursion/Longest_Common_Subsequence.cpp (100%) rename Program for fabonacci using recursion => Recursion/Program for fabonacci using recursion (100%) rename josephusProblem.cpp => Recursion/josephusProblem.cpp (100%) rename KMP_ALGORITHM.cpp => SearchingAlgorithms/KMP_ALGORITHM.cpp (100%) rename boyer_moore_horspool.cpp => SearchingAlgorithms/boyer_moore_horspool.cpp (100%) rename dis.cpp => SearchingAlgorithms/dis.cpp (100%) rename linear_search.cpp => SearchingAlgorithms/linear_search.cpp (100%) delete mode 100644 ShellSort.cpp create mode 100644 SortingAlgorithms/Cocktail_Sort.cpp rename SortInWaveForm.cpp => SortingAlgorithms/SortInWaveForm.cpp (100%) rename radix_sort_using_counting_sort.cpp => SortingAlgorithms/radix_sort_using_counting_sort.cpp (100%) rename Interleaving_string.cpp => String Related/Interleaving_string.cpp (100%) rename Next_Similar_Number.cpp => String Related/Next_Similar_Number.cpp (100%) rename Rabin_Karp_Algorithm.cpp => String Related/Rabin_Karp_Algorithm.cpp (100%) rename WordBreak.cpp => String Related/WordBreak.cpp (100%) rename Towerofhanoi_usingStack.cpp => TowerOfHanoi/Towerofhanoi_usingStack.cpp (100%) rename towerofhanoi.cpp => TowerOfHanoi/towerofhanoi.cpp (100%) rename DSU_implementation.cpp => Trees/Disjoint/DSU_implementation.cpp (100%) rename Equal_Sum_Partition.cpp => Trees/Disjoint/Equal_Sum_Partition.cpp (100%) rename Fenwick_Tree.cpp => Trees/Fenwick_Tree.cpp (100%) rename Segment_tree.cpp => Trees/Segment_tree.cpp (100%) rename Sum of all nodes value of Binary Tree.cpp => Trees/Sum of all nodes value of Binary Tree.cpp (100%) rename Trees/{ => Traversal}/inorder_traversal.cpp (100%) rename Trees/{ => Traversal}/level_order_traversal-using-queue.cpp (100%) rename Trees/{ => Traversal}/level_order_traversal.cpp (100%) rename postorder_traversal.cpp => Trees/Traversal/postorder_traversal.cpp (100%) rename preorder_traversal.cpp => Trees/Traversal/preorder_traversal.cpp (100%) rename shwetankInorderTraversal.cpp => Trees/Traversal/shwetankInorderTraversal.cpp (100%) rename lazySegmentTree.cpp => Trees/lazySegmentTree.cpp (100%) rename rangeMin.cpp => Trees/rangeMin.cpp (100%) delete mode 100644 count_sort.cpp delete mode 100644 countingsort_negative.cpp delete mode 100644 merge_sort.cpp delete mode 100644 selection_sort.cpp delete mode 100644 tim sort.cpp diff --git a/Array_Stack.cpp b/Array Related/Array_Stack.cpp similarity index 100% rename from Array_Stack.cpp rename to Array Related/Array_Stack.cpp diff --git a/Find second maximum element in array b/Array Related/Find second maximum element in array similarity index 100% rename from Find second maximum element in array rename to Array Related/Find second maximum element in array diff --git a/Left rotate an array k times.cpp b/Array Related/Left rotate an array k times.cpp similarity index 100% rename from Left rotate an array k times.cpp rename to Array Related/Left rotate an array k times.cpp diff --git a/MaximumCircularSubarraySum.cpp b/Array Related/MaximumCircularSubarraySum.cpp similarity index 100% rename from MaximumCircularSubarraySum.cpp rename to Array Related/MaximumCircularSubarraySum.cpp diff --git a/NumberSmallerThanANumberInArray.cpp b/Array Related/NumberSmallerThanANumberInArray.cpp similarity index 100% rename from NumberSmallerThanANumberInArray.cpp rename to Array Related/NumberSmallerThanANumberInArray.cpp diff --git a/Print the array in spiral form b/Array Related/Print the array in spiral form similarity index 100% rename from Print the array in spiral form rename to Array Related/Print the array in spiral form diff --git a/Queue implementation using Array.cpp b/Array Related/Queue implementation using Array.cpp similarity index 100% rename from Queue implementation using Array.cpp rename to Array Related/Queue implementation using Array.cpp diff --git a/Reverse an array.cpp b/Array Related/Reverse an array.cpp similarity index 100% rename from Reverse an array.cpp rename to Array Related/Reverse an array.cpp diff --git a/Shortest Subarray with Sum at least K.cpp b/Array Related/Shortest Subarray with Sum at least K.cpp similarity index 100% rename from Shortest Subarray with Sum at least K.cpp rename to Array Related/Shortest Subarray with Sum at least K.cpp diff --git a/Span of an Array b/Array Related/Span of an Array similarity index 100% rename from Span of an Array rename to Array Related/Span of an Array diff --git a/circular_queue_using_array.cpp b/Array Related/circular_queue_using_array.cpp similarity index 100% rename from circular_queue_using_array.cpp rename to Array Related/circular_queue_using_array.cpp diff --git a/find_span_of_an_array.cpp b/Array Related/find_span_of_an_array.cpp similarity index 100% rename from find_span_of_an_array.cpp rename to Array Related/find_span_of_an_array.cpp diff --git a/first missing.cpp b/Array Related/first missing.cpp similarity index 100% rename from first missing.cpp rename to Array Related/first missing.cpp diff --git a/kadanealgorithm.cpp b/Array Related/kadanealgorithm.cpp similarity index 100% rename from kadanealgorithm.cpp rename to Array Related/kadanealgorithm.cpp diff --git a/largest_subarray_with_zero_sum.cpp b/Array Related/largest_subarray_with_zero_sum.cpp similarity index 100% rename from largest_subarray_with_zero_sum.cpp rename to Array Related/largest_subarray_with_zero_sum.cpp diff --git a/lonelyElement.cpp b/Array Related/lonelyElement.cpp similarity index 100% rename from lonelyElement.cpp rename to Array Related/lonelyElement.cpp diff --git a/longestSubarray_with_equal_ones_and_zeros.cpp b/Array Related/longestSubarray_with_equal_ones_and_zeros.cpp similarity index 100% rename from longestSubarray_with_equal_ones_and_zeros.cpp rename to Array Related/longestSubarray_with_equal_ones_and_zeros.cpp diff --git a/median_element_of_an_array.cpp b/Array Related/median_element_of_an_array.cpp similarity index 100% rename from median_element_of_an_array.cpp rename to Array Related/median_element_of_an_array.cpp diff --git a/median_of_an_array.cpp b/Array Related/median_of_an_array.cpp similarity index 100% rename from median_of_an_array.cpp rename to Array Related/median_of_an_array.cpp diff --git a/merge_k_sorted_arrays.cpp b/Array Related/merge_k_sorted_arrays.cpp similarity index 100% rename from merge_k_sorted_arrays.cpp rename to Array Related/merge_k_sorted_arrays.cpp diff --git a/minimum number of swaps required to sort the array.cpp b/Array Related/minimum number of swaps required to sort the array.cpp similarity index 100% rename from minimum number of swaps required to sort the array.cpp rename to Array Related/minimum number of swaps required to sort the array.cpp diff --git a/repeat.cpp b/Array Related/repeat.cpp similarity index 100% rename from repeat.cpp rename to Array Related/repeat.cpp diff --git a/stack_using_array.cpp b/Array Related/stack_using_array.cpp similarity index 100% rename from stack_using_array.cpp rename to Array Related/stack_using_array.cpp diff --git a/Backtracking b/Backtracking Related/Backtracking similarity index 100% rename from Backtracking rename to Backtracking Related/Backtracking diff --git a/Rat In A Maze.cpp b/Backtracking Related/Rat In A Maze.cpp similarity index 100% rename from Rat In A Maze.cpp rename to Backtracking Related/Rat In A Maze.cpp diff --git a/Count ways to reach the n'th stair - dynamic programming.cpp b/Dynamic Programming/Count ways to reach the n'th stair - dynamic programming.cpp similarity index 100% rename from Count ways to reach the n'th stair - dynamic programming.cpp rename to Dynamic Programming/Count ways to reach the n'th stair - dynamic programming.cpp diff --git a/Kadane's Algorithm via different method b/Dynamic Programming/Kadane's Algorithm via different method similarity index 100% rename from Kadane's Algorithm via different method rename to Dynamic Programming/Kadane's Algorithm via different method diff --git a/dynamic_coin_change.cpp b/Dynamic Programming/dynamic_coin_change.cpp similarity index 100% rename from dynamic_coin_change.cpp rename to Dynamic Programming/dynamic_coin_change.cpp diff --git a/rodcut.cpp b/Dynamic Programming/rodcut.cpp similarity index 100% rename from rodcut.cpp rename to Dynamic Programming/rodcut.cpp diff --git a/HuffmanCoding.cpp b/Hashing/Encryption/HuffmanCoding.cpp similarity index 100% rename from HuffmanCoding.cpp rename to Hashing/Encryption/HuffmanCoding.cpp diff --git a/hash_table.cpp b/Hashing/Encryption/hash_table.cpp similarity index 100% rename from hash_table.cpp rename to Hashing/Encryption/hash_table.cpp diff --git a/Clockwise_rotation _of_Linked_List.cpp b/LinkedList Related/Clockwise_rotation _of_Linked_List.cpp similarity index 100% rename from Clockwise_rotation _of_Linked_List.cpp rename to LinkedList Related/Clockwise_rotation _of_Linked_List.cpp diff --git a/Delete_element_from_circular_linkedlist.cpp b/LinkedList Related/Delete_element_from_circular_linkedlist.cpp similarity index 100% rename from Delete_element_from_circular_linkedlist.cpp rename to LinkedList Related/Delete_element_from_circular_linkedlist.cpp diff --git a/Detect_Loop_in_Singly_linkedlist.cpp b/LinkedList Related/Detect_Loop_in_Singly_linkedlist.cpp similarity index 100% rename from Detect_Loop_in_Singly_linkedlist.cpp rename to LinkedList Related/Detect_Loop_in_Singly_linkedlist.cpp diff --git a/DoublyLinkedlist.cpp b/LinkedList Related/DoublyLinkedlist.cpp similarity index 100% rename from DoublyLinkedlist.cpp rename to LinkedList Related/DoublyLinkedlist.cpp diff --git a/Find length circular linked list.cpp b/LinkedList Related/Find length circular linked list.cpp similarity index 100% rename from Find length circular linked list.cpp rename to LinkedList Related/Find length circular linked list.cpp diff --git a/FrequencyOfNumberInLinkedList.cpp b/LinkedList Related/FrequencyOfNumberInLinkedList.cpp similarity index 100% rename from FrequencyOfNumberInLinkedList.cpp rename to LinkedList Related/FrequencyOfNumberInLinkedList.cpp diff --git a/LinkedListMiddle.cpp b/LinkedList Related/LinkedListMiddle.cpp similarity index 100% rename from LinkedListMiddle.cpp rename to LinkedList Related/LinkedListMiddle.cpp diff --git a/Merge two unsorted linked list b/LinkedList Related/Merge two unsorted linked list similarity index 100% rename from Merge two unsorted linked list rename to LinkedList Related/Merge two unsorted linked list diff --git a/Print Nth node from end in singly linked list.cpp b/LinkedList Related/Print Nth node from end in singly linked list.cpp similarity index 100% rename from Print Nth node from end in singly linked list.cpp rename to LinkedList Related/Print Nth node from end in singly linked list.cpp diff --git a/Reverse Linked List b/LinkedList Related/Reverse Linked List similarity index 100% rename from Reverse Linked List rename to LinkedList Related/Reverse Linked List diff --git a/SinglyLinkedList.cpp b/LinkedList Related/SinglyLinkedList.cpp similarity index 100% rename from SinglyLinkedList.cpp rename to LinkedList Related/SinglyLinkedList.cpp diff --git a/SinglyLinkedListIsPalidrome.cpp b/LinkedList Related/SinglyLinkedListIsPalidrome.cpp similarity index 100% rename from SinglyLinkedListIsPalidrome.cpp rename to LinkedList Related/SinglyLinkedListIsPalidrome.cpp diff --git a/XORlist.cpp b/LinkedList Related/XORlist.cpp similarity index 100% rename from XORlist.cpp rename to LinkedList Related/XORlist.cpp diff --git a/all_operations_doublyLinkedList b/LinkedList Related/all_operations_doublyLinkedList similarity index 100% rename from all_operations_doublyLinkedList rename to LinkedList Related/all_operations_doublyLinkedList diff --git a/binaryLLtoDecimal.cpp b/LinkedList Related/binaryLLtoDecimal.cpp similarity index 100% rename from binaryLLtoDecimal.cpp rename to LinkedList Related/binaryLLtoDecimal.cpp diff --git a/double_circular_linkedlist.cpp b/LinkedList Related/double_circular_linkedlist.cpp similarity index 100% rename from double_circular_linkedlist.cpp rename to LinkedList Related/double_circular_linkedlist.cpp diff --git a/searchelementincircularLL.cpp b/LinkedList Related/searchelementincircularLL.cpp similarity index 100% rename from searchelementincircularLL.cpp rename to LinkedList Related/searchelementincircularLL.cpp diff --git a/skiplist.cpp b/LinkedList Related/skiplist.cpp similarity index 100% rename from skiplist.cpp rename to LinkedList Related/skiplist.cpp diff --git a/MultiplicationWithoutUsingMultiplicationOperator.cpp b/Math/number Related/ Operations/MultiplicationWithoutUsingMultiplicationOperator.cpp similarity index 100% rename from MultiplicationWithoutUsingMultiplicationOperator.cpp rename to Math/number Related/ Operations/MultiplicationWithoutUsingMultiplicationOperator.cpp diff --git a/multiplication-without-multiplication_operator b/Math/number Related/ Operations/multiplication-without-multiplication_operator similarity index 100% rename from multiplication-without-multiplication_operator rename to Math/number Related/ Operations/multiplication-without-multiplication_operator diff --git a/power.cpp b/Math/number Related/ Operations/power.cpp similarity index 100% rename from power.cpp rename to Math/number Related/ Operations/power.cpp diff --git a/power_of_2.cpp b/Math/number Related/ Operations/power_of_2.cpp similarity index 100% rename from power_of_2.cpp rename to Math/number Related/ Operations/power_of_2.cpp diff --git a/remainder-without-modulo.cpp b/Math/number Related/ Operations/remainder-without-modulo.cpp similarity index 100% rename from remainder-without-modulo.cpp rename to Math/number Related/ Operations/remainder-without-modulo.cpp diff --git a/simpleSum.cpp b/Math/number Related/ Operations/simpleSum.cpp similarity index 100% rename from simpleSum.cpp rename to Math/number Related/ Operations/simpleSum.cpp diff --git a/sqrt.cpp b/Math/number Related/ Operations/sqrt.cpp similarity index 100% rename from sqrt.cpp rename to Math/number Related/ Operations/sqrt.cpp diff --git a/BleakNumber.cpp b/Math/number Related/BleakNumber.cpp similarity index 100% rename from BleakNumber.cpp rename to Math/number Related/BleakNumber.cpp diff --git a/CalculatorInC++.c++ b/Math/number Related/CalculatorInC++.c++ similarity index 100% rename from CalculatorInC++.c++ rename to Math/number Related/CalculatorInC++.c++ diff --git a/eular_totient.cpp b/Math/number Related/Functions/eular_totient.cpp similarity index 100% rename from eular_totient.cpp rename to Math/number Related/Functions/eular_totient.cpp diff --git a/GCD.cpp b/Math/number Related/GCD.cpp similarity index 100% rename from GCD.cpp rename to Math/number Related/GCD.cpp diff --git a/Happy_Number.cpp b/Math/number Related/Happy_Number.cpp similarity index 100% rename from Happy_Number.cpp rename to Math/number Related/Happy_Number.cpp diff --git a/HelpfulMaths.cpp b/Math/number Related/HelpfulMaths.cpp similarity index 100% rename from HelpfulMaths.cpp rename to Math/number Related/HelpfulMaths.cpp diff --git a/LargestEvenNumber.cpp b/Math/number Related/LargestEvenNumber.cpp similarity index 100% rename from LargestEvenNumber.cpp rename to Math/number Related/LargestEvenNumber.cpp diff --git a/NewtonRaphsonAlgo.cpp b/Math/number Related/NewtonRaphsonAlgo.cpp similarity index 100% rename from NewtonRaphsonAlgo.cpp rename to Math/number Related/NewtonRaphsonAlgo.cpp diff --git a/Pascals_triangle.cpp b/Math/number Related/Pascals_triangle.cpp similarity index 100% rename from Pascals_triangle.cpp rename to Math/number Related/Pascals_triangle.cpp diff --git a/Rotate_number_by_k.cpp b/Math/number Related/Rotate_number_by_k.cpp similarity index 100% rename from Rotate_number_by_k.cpp rename to Math/number Related/Rotate_number_by_k.cpp diff --git a/SeparateEvenAndOddNumbers.cpp b/Math/number Related/SeparateEvenAndOddNumbers.cpp similarity index 100% rename from SeparateEvenAndOddNumbers.cpp rename to Math/number Related/SeparateEvenAndOddNumbers.cpp diff --git a/CalculateTheGivenSeries.cpp b/Math/number Related/Series/CalculateTheGivenSeries.cpp similarity index 100% rename from CalculateTheGivenSeries.cpp rename to Math/number Related/Series/CalculateTheGivenSeries.cpp diff --git a/TaylorSeriesByHorner'sRule.cpp b/Math/number Related/Series/TaylorSeriesByHorner'sRule.cpp similarity index 100% rename from TaylorSeriesByHorner'sRule.cpp rename to Math/number Related/Series/TaylorSeriesByHorner'sRule.cpp diff --git a/SubsetSum.cpp b/Math/number Related/SubsetSum.cpp similarity index 100% rename from SubsetSum.cpp rename to Math/number Related/SubsetSum.cpp diff --git a/SwapTwoNibbles.cpp b/Math/number Related/SwapTwoNibbles.cpp similarity index 100% rename from SwapTwoNibbles.cpp rename to Math/number Related/SwapTwoNibbles.cpp diff --git a/Three_Sum.cpp b/Math/number Related/Three_Sum.cpp similarity index 100% rename from Three_Sum.cpp rename to Math/number Related/Three_Sum.cpp diff --git a/Trailing zeroes.cpp b/Math/number Related/Trailing zeroes.cpp similarity index 100% rename from Trailing zeroes.cpp rename to Math/number Related/Trailing zeroes.cpp diff --git a/Two_Sum.cpp b/Math/number Related/Two_Sum.cpp similarity index 100% rename from Two_Sum.cpp rename to Math/number Related/Two_Sum.cpp diff --git a/factorial.cpp b/Math/number Related/factorial.cpp similarity index 100% rename from factorial.cpp rename to Math/number Related/factorial.cpp diff --git a/fibonacci_xor.cpp b/Math/number Related/fibonacci_xor.cpp similarity index 100% rename from fibonacci_xor.cpp rename to Math/number Related/fibonacci_xor.cpp diff --git a/finding a perfect number b/Math/number Related/finding a perfect number similarity index 100% rename from finding a perfect number rename to Math/number Related/finding a perfect number diff --git a/longest_subsequence.cpp b/Math/number Related/longest_subsequence.cpp similarity index 100% rename from longest_subsequence.cpp rename to Math/number Related/longest_subsequence.cpp diff --git a/nCr.cpp b/Math/number Related/nCr.cpp similarity index 100% rename from nCr.cpp rename to Math/number Related/nCr.cpp diff --git a/ntUglyNumber b/Math/number Related/ntUglyNumber similarity index 100% rename from ntUglyNumber rename to Math/number Related/ntUglyNumber diff --git a/nth_catalan.cpp b/Math/number Related/nth_catalan.cpp similarity index 100% rename from nth_catalan.cpp rename to Math/number Related/nth_catalan.cpp diff --git a/palindrome1.cpp b/Math/number Related/palindrome1.cpp similarity index 100% rename from palindrome1.cpp rename to Math/number Related/palindrome1.cpp diff --git a/perfectnums.cpp b/Math/number Related/perfectnums.cpp similarity index 100% rename from perfectnums.cpp rename to Math/number Related/perfectnums.cpp diff --git a/prime_factorisation.cpp b/Math/number Related/prime_factorisation.cpp similarity index 100% rename from prime_factorisation.cpp rename to Math/number Related/prime_factorisation.cpp diff --git a/sieveOfEratosthenes.cpp b/Math/number Related/sieveOfEratosthenes.cpp similarity index 100% rename from sieveOfEratosthenes.cpp rename to Math/number Related/sieveOfEratosthenes.cpp diff --git a/square_root.cpp b/Math/number Related/square_root.cpp similarity index 100% rename from square_root.cpp rename to Math/number Related/square_root.cpp diff --git a/Binary Matrix.cpp b/Matrix Related/Binary Matrix.cpp similarity index 100% rename from Binary Matrix.cpp rename to Matrix Related/Binary Matrix.cpp diff --git a/MatrixChainMultiplication.cpp b/Matrix Related/MatrixChainMultiplication.cpp similarity index 100% rename from MatrixChainMultiplication.cpp rename to Matrix Related/MatrixChainMultiplication.cpp diff --git a/Rotate_matrixby90deg.c b/Matrix Related/Rotate_matrixby90deg.c similarity index 100% rename from Rotate_matrixby90deg.c rename to Matrix Related/Rotate_matrixby90deg.c diff --git a/SparseMatricesAdd.cpp b/Matrix Related/Sparse Matrix/SparseMatricesAdd.cpp similarity index 100% rename from SparseMatricesAdd.cpp rename to Matrix Related/Sparse Matrix/SparseMatricesAdd.cpp diff --git a/matrix_to_sparse.cpp b/Matrix Related/Sparse Matrix/matrix_to_sparse.cpp similarity index 100% rename from matrix_to_sparse.cpp rename to Matrix Related/Sparse Matrix/matrix_to_sparse.cpp diff --git a/Sparse Matrix/sparse matrix.cpp b/Matrix Related/Sparse Matrix/sparse matrix.cpp similarity index 100% rename from Sparse Matrix/sparse matrix.cpp rename to Matrix Related/Sparse Matrix/sparse matrix.cpp diff --git a/Spiral traversal of matrix b/Matrix Related/Spiral traversal of matrix similarity index 100% rename from Spiral traversal of matrix rename to Matrix Related/Spiral traversal of matrix diff --git a/SpiralOdereMatrixTraversal.cpp b/Matrix Related/SpiralOdereMatrixTraversal.cpp similarity index 100% rename from SpiralOdereMatrixTraversal.cpp rename to Matrix Related/SpiralOdereMatrixTraversal.cpp diff --git "a/Strassen\342\200\231s Algorithm.cpp" "b/Matrix Related/Strassen\342\200\231s Algorithm.cpp" similarity index 100% rename from "Strassen\342\200\231s Algorithm.cpp" rename to "Matrix Related/Strassen\342\200\231s Algorithm.cpp" diff --git a/Vector representation of genreal sparse Matrix b/Matrix Related/Vector representation of genreal sparse Matrix similarity index 100% rename from Vector representation of genreal sparse Matrix rename to Matrix Related/Vector representation of genreal sparse Matrix diff --git a/fibonacciNumberUsingMatrix.cpp b/Matrix Related/fibonacciNumberUsingMatrix.cpp similarity index 100% rename from fibonacciNumberUsingMatrix.cpp rename to Matrix Related/fibonacciNumberUsingMatrix.cpp diff --git a/fibonacciNumberUsingMatrix.exe b/Matrix Related/fibonacciNumberUsingMatrix.exe similarity index 100% rename from fibonacciNumberUsingMatrix.exe rename to Matrix Related/fibonacciNumberUsingMatrix.exe diff --git a/matrix multiplication.cpp b/Matrix Related/matrix multiplication.cpp similarity index 100% rename from matrix multiplication.cpp rename to Matrix Related/matrix multiplication.cpp diff --git a/494-Target_sum-Leetcode-DP.cpp b/Miscellaneous/494-Target_sum-Leetcode-DP.cpp similarity index 100% rename from 494-Target_sum-Leetcode-DP.cpp rename to Miscellaneous/494-Target_sum-Leetcode-DP.cpp diff --git a/Abhinav_LongestAP.cpp b/Miscellaneous/Abhinav_LongestAP.cpp similarity index 100% rename from Abhinav_LongestAP.cpp rename to Miscellaneous/Abhinav_LongestAP.cpp diff --git a/Best_time_to_buy_stock_and_sell.cpp b/Miscellaneous/Best_time_to_buy_stock_and_sell.cpp similarity index 100% rename from Best_time_to_buy_stock_and_sell.cpp rename to Miscellaneous/Best_time_to_buy_stock_and_sell.cpp diff --git a/CG2.cpp b/Miscellaneous/CG2.cpp similarity index 100% rename from CG2.cpp rename to Miscellaneous/CG2.cpp diff --git a/Check Balanced Paranthesis.cpp b/Miscellaneous/Check Balanced Paranthesis.cpp similarity index 100% rename from Check Balanced Paranthesis.cpp rename to Miscellaneous/Check Balanced Paranthesis.cpp diff --git a/Coins_Denomination.cpp b/Miscellaneous/Coins_Denomination.cpp similarity index 100% rename from Coins_Denomination.cpp rename to Miscellaneous/Coins_Denomination.cpp diff --git a/GoldMineProblem.cpp b/Miscellaneous/GoldMineProblem.cpp similarity index 100% rename from GoldMineProblem.cpp rename to Miscellaneous/GoldMineProblem.cpp diff --git a/MinTimeVisitPoints.cpp b/Miscellaneous/MinTimeVisitPoints.cpp similarity index 100% rename from MinTimeVisitPoints.cpp rename to Miscellaneous/MinTimeVisitPoints.cpp diff --git a/Minimax.cpp b/Miscellaneous/Minimax.cpp similarity index 100% rename from Minimax.cpp rename to Miscellaneous/Minimax.cpp diff --git a/Minimum_Path_Sum.cpp b/Miscellaneous/Minimum_Path_Sum.cpp similarity index 100% rename from Minimum_Path_Sum.cpp rename to Miscellaneous/Minimum_Path_Sum.cpp diff --git a/Peak Element.cpp b/Miscellaneous/Peak Element.cpp similarity index 100% rename from Peak Element.cpp rename to Miscellaneous/Peak Element.cpp diff --git a/PotsOfGold.cpp b/Miscellaneous/PotsOfGold.cpp similarity index 100% rename from PotsOfGold.cpp rename to Miscellaneous/PotsOfGold.cpp diff --git a/SmallerThanCurrent.cpp b/Miscellaneous/SmallerThanCurrent.cpp similarity index 100% rename from SmallerThanCurrent.cpp rename to Miscellaneous/SmallerThanCurrent.cpp diff --git a/activity_selection.cpp b/Miscellaneous/activity_selection.cpp similarity index 100% rename from activity_selection.cpp rename to Miscellaneous/activity_selection.cpp diff --git a/bankers_algorithm_safe_state.cpp b/Miscellaneous/bankers_algorithm_safe_state.cpp similarity index 100% rename from bankers_algorithm_safe_state.cpp rename to Miscellaneous/bankers_algorithm_safe_state.cpp diff --git a/count_connected_components.cpp b/Miscellaneous/count_connected_components.cpp similarity index 100% rename from count_connected_components.cpp rename to Miscellaneous/count_connected_components.cpp diff --git a/linedraw.cpp b/Miscellaneous/linedraw.cpp similarity index 100% rename from linedraw.cpp rename to Miscellaneous/linedraw.cpp diff --git a/minimum_swaps_to_sort_shanti16r.cpp b/Miscellaneous/minimum_swaps_to_sort_shanti16r.cpp similarity index 100% rename from minimum_swaps_to_sort_shanti16r.cpp rename to Miscellaneous/minimum_swaps_to_sort_shanti16r.cpp diff --git a/optimalStratergy.cpp b/Miscellaneous/optimalStratergy.cpp similarity index 100% rename from optimalStratergy.cpp rename to Miscellaneous/optimalStratergy.cpp diff --git a/Longest_Palindromic_Subsequence.cpp b/Palindrome Related/Longest_Palindromic_Subsequence.cpp similarity index 100% rename from Longest_Palindromic_Subsequence.cpp rename to Palindrome Related/Longest_Palindromic_Subsequence.cpp diff --git a/StringPalindrome.cpp b/Palindrome Related/StringPalindrome.cpp similarity index 100% rename from StringPalindrome.cpp rename to Palindrome Related/StringPalindrome.cpp diff --git a/check_if_number_is_palindrome_Scientist69.cpp b/Palindrome Related/check_if_number_is_palindrome_Scientist69.cpp similarity index 100% rename from check_if_number_is_palindrome_Scientist69.cpp rename to Palindrome Related/check_if_number_is_palindrome_Scientist69.cpp diff --git a/check_whether_number_is_palindrome_or_not_Scientist69.cpp b/Palindrome Related/check_whether_number_is_palindrome_or_not_Scientist69.cpp similarity index 100% rename from check_whether_number_is_palindrome_or_not_Scientist69.cpp rename to Palindrome Related/check_whether_number_is_palindrome_or_not_Scientist69.cpp diff --git a/FIBONACCI _RECURSION.CPP b/Recursion/FIBONACCI _RECURSION.CPP similarity index 100% rename from FIBONACCI _RECURSION.CPP rename to Recursion/FIBONACCI _RECURSION.CPP diff --git a/Josephus Problem b/Recursion/Josephus Problem similarity index 100% rename from Josephus Problem rename to Recursion/Josephus Problem diff --git a/Longest_Common_Subsequence.cpp b/Recursion/Longest_Common_Subsequence.cpp similarity index 100% rename from Longest_Common_Subsequence.cpp rename to Recursion/Longest_Common_Subsequence.cpp diff --git a/Program for fabonacci using recursion b/Recursion/Program for fabonacci using recursion similarity index 100% rename from Program for fabonacci using recursion rename to Recursion/Program for fabonacci using recursion diff --git a/josephusProblem.cpp b/Recursion/josephusProblem.cpp similarity index 100% rename from josephusProblem.cpp rename to Recursion/josephusProblem.cpp diff --git a/KMP_ALGORITHM.cpp b/SearchingAlgorithms/KMP_ALGORITHM.cpp similarity index 100% rename from KMP_ALGORITHM.cpp rename to SearchingAlgorithms/KMP_ALGORITHM.cpp diff --git a/boyer_moore_horspool.cpp b/SearchingAlgorithms/boyer_moore_horspool.cpp similarity index 100% rename from boyer_moore_horspool.cpp rename to SearchingAlgorithms/boyer_moore_horspool.cpp diff --git a/dis.cpp b/SearchingAlgorithms/dis.cpp similarity index 100% rename from dis.cpp rename to SearchingAlgorithms/dis.cpp diff --git a/linear_search.cpp b/SearchingAlgorithms/linear_search.cpp similarity index 100% rename from linear_search.cpp rename to SearchingAlgorithms/linear_search.cpp diff --git a/ShellSort.cpp b/ShellSort.cpp deleted file mode 100644 index 026519bc..00000000 --- a/ShellSort.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -Short Introduction:- -Shell sort is a highly efficient sorting algorithm and is based on insertion sort algorithm. -This algorithm avoids large shifts as in case of insertion sort, if the smaller value is to the far right -and has to be moved to the far left.This algorithm uses insertion sort on a widely spread elements, first to sort -them and then sorts the less widely spaced elements. This spacing is termed as interval. - -Complexities:- -Worst case time complexity = O(n2) -Best case complexity = O(nlog(n)). -Space complexity = O(1). -*/ - - -#include -using namespace std; -/*Method to sort the list/array*/ -void shellSort(int sort[],int size){ - for(int gap=size/2;gap>0;gap/=2){ - for(int i=gap;i=gap&&sort[j-gap]>temp;j-=gap){ - sort[j]=sort[j-gap]; - } - sort[j]=temp; - } - } -} -//main program -int main(){ - int size; - cout<<"Enter the size of the array: "; - cin>>size; - int sort[size]; - cout<<"Enter the Elements to be sorted:"; - for(int i=0;i>sort[i]; - } - shellSort(sort,size); - cout<<"Array after sorting is: "; - for(int i=0;i +#include +#include +using namespace std; + +vector cocktail_sort(vector& arr) +{ + //loop through the vector n/2 times (n = number of elements) + for(int i=0;i arr[j]) + { + swap(arr[j-1], arr[j]); + } + } + + //buuble sort: move smaller number to left + for(int j=arr.size()-1; j>1; j--) + { + if(arr[j] < arr[j-1]) + { + swap(arr[j-1], arr[j]); + } + } + } + + return arr; +} + +int main() +{ + static random_device rd; + static mt19937 rng(rd()); + static uniform_int_distribution randRange(-100, 100); + + vector test; + + //test + cout << "test1:" << endl; + cout << "Orginal vector: "; + for(int i=0; i < 10; i++) + { + test.push_back(randRange(rd)); + cout< 0; i--) + { + test.push_back(i); + cout<< i << ", "; + } + cout << endl; + + cocktail_sort(test); + + cout << "Cocktail Sort result: "; + for(int i=0; i < test.size(); i++) + { + cout< 0; i-=2) + { + test.push_back(i); + test.push_back(i); + cout<< i << ", "; + cout<< i << ", "; + } + cout << endl; + + cocktail_sort(test); + + cout << "Cocktail Sort result: "; + for(int i=0; i < test.size(); i++) + { + cout< -using namespace std; - -void count_sort(int arr[],int size){ - int max = arr[0]; - for (int i=0;i>num; - - int arr[num]; - - cout<<"Enter "<>arr[n]; - } - - count_sort(arr, num); - - cout<<"Here is the sorted array : "< -#include -using namespace std; - -void counting_sort(int arr[], int size) -{ - int max = *max_element(arr, arr + size); - int min = *min_element(arr, arr + size); - - int range = max - min + 1; - - int count[range] = {0}; - - // counting frequency of numbers in array - for (int i = 0; i < size; i++) - { - count[arr[i] - min]++; - } - - // calculating cumulative sum - for (int i = 1; i < range; i++) - { - count[i] += count[i - 1]; - } - - int output[size]; - - // making the new sorted array - for (int i = size - 1; i >= 0; i--) // traversing from backward for stability - { - output[count[arr[i]-min] - 1] = arr[i]; - count[arr[i]-min]--; - } - - // copying the sorted array in original array - for (int i = 0; i < size; i++) - { - arr[i] = output[i]; - } -} - -int main() -{ - int size; - cout << "\nenter size of the array : "; - cin >> size; - - int arr[size]; - cout << "Start entering values in array (numeric type) : "; - for (int i = 0; i < size; i++) - { - cout << i + 1 << ") "; - cin >> arr[i]; - } - - counting_sort(arr, size); - - cout << "After sorting : "; - for (int i = 0; i < size; i++) - { - cout << arr[i] << " "; - } - - return 0; -} diff --git a/merge_sort.cpp b/merge_sort.cpp deleted file mode 100644 index 9e72ee8e..00000000 --- a/merge_sort.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Merge Sort -// Time complexity: O(N*log(N)) - - -#include -using namespace std; -#define ll long long int - -void merge(vector &a, int l, int m, int r){ - int i, j, k; - int n1 = m - l + 1; - int n2 = r - m; - vector Left(n1), Right(n2); - for(i = 0; i < n1; i++) Left[i] = a[l + i]; - for(i = 0; i < n2; i++) Right[i] = a[m + 1 + i]; - - i = 0; - j = 0; - k = l; - - while(i < n1 && j < n2){ - if(Left[i] <= Right[j]) - a[k] = Left[i++]; - else - a[k] = Right[j++]; - k++; - } - - while(i < n1) - a[k++] = Left[i++]; - while(j < n2) - a[k++] = Right[j++]; -} -void mergeSort(vector &a, int l, int r){ - if(l < r){ - int m = (r + l) / 2; - mergeSort(a, l, m); - mergeSort(a, m + 1, r); - merge(a, l, m, r); - } -} - -int main(){ - cout << "Enter number of elements: \n"; - int N; cin >> N; - vector a(N); - int i; - - cout << "Enter elements of array: \n"; - for(i = 0; i < N; i++){ - cin >> a[i]; - } - - mergeSort(a, 0, N - 1); - - for(i = 0; i < N; i++) - cout << a[i] << " "; -} diff --git a/selection_sort.cpp b/selection_sort.cpp deleted file mode 100644 index b6ced9a2..00000000 --- a/selection_sort.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Selection Sort -// Find the minimum element from the unsorted part of the array and put it at the beginning of the unsorted array. -// Time complexity: O(N^2) - - -#include -using namespace std; -#define ll long long int - -int main(){ - cout << "Enter number of elements: \n"; - int N; cin >> N; - vector a(N); - int i, j, min_idx; - - cout << "Enter elements of array: \n"; - for(i = 0; i < N; i++){ - cin >> a[i]; - } - - // Selection Sort - for(i = 0; i < N; i++){ - min_idx = i; - for(j = i + 1; j < N; j++){ - if(a[j] < a[min_idx]) - min_idx = j; // Find the index of minimum element - } - swap(a[i], a[min_idx]); - } - - //Print sorted array - for(i = 0; i < N; i++) - cout << a[i] << " "; -} diff --git a/tim sort.cpp b/tim sort.cpp deleted file mode 100644 index c1aef89e..00000000 --- a/tim sort.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include -using namespace std; -const int RUN = 32; - -void insertionSort(int arr[], int left, int right) -{ - for (int i = left + 1; i <= right; i++) - { - int temp = arr[i]; - int j = i - 1; - while (j >= left && arr[j] > temp) - { - arr[j + 1] = arr[j]; - j--; - } - arr[j + 1] = temp; - } -} - -void merge(int arr[], int l, int m, int r) -{ - int len1 = m - l + 1, len2 = r - m; - int left[len1], right[len2]; - for (int i = 0; i < len1; i++) - left[i] = arr[l + i]; - for (int i = 0; i < len2; i++) - right[i] = arr[m + 1 + i]; - - int i = 0; - int j = 0; - int k = l; - while (i < len1 && j < len2) - { - if (left[i] <= right[j]) - { - arr[k] = left[i]; - i++; - } - else - { - arr[k] = right[j]; - j++; - } - k++; - } - - while (i < len1) - { - arr[k] = left[i]; - k++; - i++; - } - while (j < len2) - { - arr[k] = right[j]; - k++; - j++; - } -} -void timSort(int arr[], int n) -{ - for (int i = 0; i < n; i += RUN) - insertionSort(arr, i, min((i + 31), (n - 1))); - for (int size = RUN; size < n; size = 2 * size) - { - for (int left = 0; left < n; left += 2 * size) - { - int mid = left + size - 1; - int right = min((left + 2 * size - 1), (n - 1)); - - merge(arr, left, mid, right); - } - } -} - -void printArray(int arr[], int n) -{ - for (int i = 0; i < n; i++) - printf("%d ", arr[i]); - printf("\n"); -} -int main() -{ - int arr[] = {5, 21, 7, 23, 19}; - int n = sizeof(arr) / sizeof(arr[0]); - printf("Given Array is\n"); - printArray(arr, n); - - timSort(arr, n); - - printf("After Sorting Array is\n"); - printArray(arr, n); - return 0; -} \ No newline at end of file