From b4cc2e6fadef019c7ce1d18d30095e2d0bfea44f Mon Sep 17 00:00:00 2001 From: Deepak Raj Date: Mon, 5 Oct 2020 22:49:00 +0530 Subject: [PATCH] updating README --- C++/Algorithms/Bit Manipulation/README.md | 0 C++/Algorithms/NumberTheory/README.md | 0 C++/Algorithms/Pattern Matching/README.md | 0 C++/Algorithms/SearchingAlgorithms/README.md | 94 +++- C++/Algorithms/Sieve Algorithms/README.md | 0 C++/Algorithms/SortingAlgorithms/README.md | 0 .../DeepLearningAlgorithms/README.md | 0 Python/Algorithms/DivideAndConquer/README.md | 0 Python/Algorithms/DynamicPrograming/README.md | 0 .../EularianPathAlgorithms/README.md | 0 .../MachineLearningAlgorithms/README.md | 0 .../PathFindingAlgorithms/README.md | 0 .../Permutations_of_string/README.md | 0 .../Algorithms/RecursionAlgorithms/README.md | 0 .../Algorithms/SearchingAlgorithms/README.md | 9 +- Python/Algorithms/SortingAlgorithms/README.md | 0 Python/Algorithms/SpiralMatrix/README.md | 0 .../assest/image}/searchalgos.png | Bin docs/index.html | 472 ++++++++++++++++++ 19 files changed, 557 insertions(+), 18 deletions(-) create mode 100644 C++/Algorithms/Bit Manipulation/README.md create mode 100644 C++/Algorithms/NumberTheory/README.md create mode 100644 C++/Algorithms/Pattern Matching/README.md create mode 100644 C++/Algorithms/Sieve Algorithms/README.md create mode 100644 C++/Algorithms/SortingAlgorithms/README.md create mode 100644 Python/Algorithms/DeepLearningAlgorithms/README.md create mode 100644 Python/Algorithms/DivideAndConquer/README.md create mode 100644 Python/Algorithms/DynamicPrograming/README.md create mode 100644 Python/Algorithms/EularianPathAlgorithms/README.md create mode 100644 Python/Algorithms/MachineLearningAlgorithms/README.md create mode 100644 Python/Algorithms/PathFindingAlgorithms/README.md create mode 100644 Python/Algorithms/Permutations_of_string/README.md create mode 100644 Python/Algorithms/RecursionAlgorithms/README.md create mode 100644 Python/Algorithms/SortingAlgorithms/README.md create mode 100644 Python/Algorithms/SpiralMatrix/README.md rename {Python/Algorithms/SearchingAlgorithms => docs/assest/image}/searchalgos.png (100%) create mode 100644 docs/index.html diff --git a/C++/Algorithms/Bit Manipulation/README.md b/C++/Algorithms/Bit Manipulation/README.md new file mode 100644 index 00000000..e69de29b diff --git a/C++/Algorithms/NumberTheory/README.md b/C++/Algorithms/NumberTheory/README.md new file mode 100644 index 00000000..e69de29b diff --git a/C++/Algorithms/Pattern Matching/README.md b/C++/Algorithms/Pattern Matching/README.md new file mode 100644 index 00000000..e69de29b diff --git a/C++/Algorithms/SearchingAlgorithms/README.md b/C++/Algorithms/SearchingAlgorithms/README.md index 5bc95d72..19f51e76 100644 --- a/C++/Algorithms/SearchingAlgorithms/README.md +++ b/C++/Algorithms/SearchingAlgorithms/README.md @@ -1,13 +1,81 @@ -# Searching Algorithms :- -> Searching Algorithms are used to search data in data structures. Searching Algorithms may differ for different Data Stuctures. - -## General Searching Algorithms for Sorted Arrays :- -- Linear Search -- Binary Search -- Ternary Search -- Jump Search -- Interpolation Search.. etc - -## General Searching Algorithms used to search in Graphs :- -- Breadth for search -- Depth for search \ No newline at end of file +

+ +

+

+ +## Introduction + +Searching for data stored in different data structures is a crucial part of pretty much every single application. + +There are many different algorithms available to utilize when searching, and each have different implementations and rely on different data structures to get the job done. + +Being able to choose a specific algorithm for a given task is a key skill for developers and can mean the difference between a fast, reliable and stable application and an application that crumbles from a simple request. + +* Linear Search +* Binary Search +* Jump Search +* Fibonacci Search +* Exponential Search +* Interpolation Search + +## Linear Search + +Linear search is one of the simplest searching algorithms, and the easiest to understand. We can think of it as a ramped-up version of our own implementation of Python's in operator. + +The algorithm consists of iterating over an array and returning the index of the first occurrence of an item once it is found. + +The time complexity of linear search is O(n), meaning that the time taken to execute increases with the number of items in our input list + +## Binary Search + +Binary search follows a divide and conquer methodology. It is faster than linear search but requires that the array be sorted before the algorithm is executed. + +Assuming that we're searching for a value val in a sorted array, the algorithm compares val to the value of the middle element of the array, which we'll call mid. + +* If mid is the element we are looking for (best case), we return its index. +* If not, we identify which side of mid val is more likely to be on based on whether val is smaller or greater than mid, and discard the other side of the array. +* We then recursively or iteratively follow the same steps, choosing a new value for mid, comparing it with val and discarding half of the possible matches in each iteration of the algorithm. + +We can only pick one possibility per iteration, and our pool of possible matches gets divided by two in each iteration. This makes the time complexity of binary search O(log n). + +## Jump Search + +Jump Search is similar to binary search in that it works on a sorted array, and uses a similar divide and conquer approach to search through it. + +It can be classified as an improvement of the linear search algorithm since it depends on linear search to perform the actual comparison when searching for a value. + +Given a sorted array, instead of searching through the array elements incrementally, we search in jumps. + +The time complexity of jump search is O(√n), where √n is the jump size, and n is the length of the list, placing jump search between the linear search and binary search algorithms in terms of efficiency. + +## Fibonacci Search + +Fibonacci search is another divide and conquer algorithm which bears similarities to both binary search and jump search. It gets its name because it uses Fibonacci numbers to calculate the block size or search range in each step. + +Fibonacci numbers start with zero and follow the pattern 0, 1, 1, 2, 3, 5, 8, 13, 21... where each element is the addition of the two numbers that immediately precede it. +The algorithm works with three Fibonacci numbers at a time. + +The time complexity for Fibonacci search is O(log n); the same as binary search. This means the algorithm is faster than both linear search and jump search in most cases. + +## Exponential Search + +Exponential search is another search algorithm that can be implemented quite simply in Python, compared to jump search and Fibonacci search which are both a bit complex. It is also known by the names galloping search, doubling search and Struzik search. + +Exponential search depends on binary search to perform the final comparison of values. The algorithm works by: + +* Determining the range where the element we're looking for is likely to be +* Using binary search for the range to find the exact index of the item + +Exponential search runs in O(log i) time, where i is the index of the item we are searching for. In its worst case, the time complexity is O(log n), when the last item is the item we are searching for (n being the length of the array). + +## Interpolation Search + +Interpolation search is another divide and conquer algorithm, similar to binary search. Unlike binary search, it does not always begin searching at the middle. + +The time complexity of interpolation search is O(log log n) when values are uniformly distributed. If values are not uniformly distributed, the worst-case time complexity is O(n), the same as linear search. + +Interpolation search works best on uniformly distributed, sorted arrays. Whereas binary search starts in the middle and always divides into two, interpolation search calculates the likely position of the element and checks the index, making it more likely to find the element in a smaller number of iterations. + +

+ +

diff --git a/C++/Algorithms/Sieve Algorithms/README.md b/C++/Algorithms/Sieve Algorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/C++/Algorithms/SortingAlgorithms/README.md b/C++/Algorithms/SortingAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/DeepLearningAlgorithms/README.md b/Python/Algorithms/DeepLearningAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/DivideAndConquer/README.md b/Python/Algorithms/DivideAndConquer/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/DynamicPrograming/README.md b/Python/Algorithms/DynamicPrograming/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/EularianPathAlgorithms/README.md b/Python/Algorithms/EularianPathAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/MachineLearningAlgorithms/README.md b/Python/Algorithms/MachineLearningAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/PathFindingAlgorithms/README.md b/Python/Algorithms/PathFindingAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/Permutations_of_string/README.md b/Python/Algorithms/Permutations_of_string/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/RecursionAlgorithms/README.md b/Python/Algorithms/RecursionAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/SearchingAlgorithms/README.md b/Python/Algorithms/SearchingAlgorithms/README.md index 2268e778..19f51e76 100644 --- a/Python/Algorithms/SearchingAlgorithms/README.md +++ b/Python/Algorithms/SearchingAlgorithms/README.md @@ -1,6 +1,6 @@

-

+

## Introduction @@ -24,7 +24,7 @@ Linear search is one of the simplest searching algorithms, and the easiest to un The algorithm consists of iterating over an array and returning the index of the first occurrence of an item once it is found. -The time complexity of linear search is O(n), meaning that the time taken to execute increases with the number of items in our input list +The time complexity of linear search is O(n), meaning that the time taken to execute increases with the number of items in our input list ## Binary Search @@ -44,7 +44,7 @@ Jump Search is similar to binary search in that it works on a sorted array, and It can be classified as an improvement of the linear search algorithm since it depends on linear search to perform the actual comparison when searching for a value. -Given a sorted array, instead of searching through the array elements incrementally, we search in jumps. +Given a sorted array, instead of searching through the array elements incrementally, we search in jumps. The time complexity of jump search is O(√n), where √n is the jump size, and n is the length of the list, placing jump search between the linear search and binary search algorithms in terms of efficiency. @@ -53,7 +53,7 @@ The time complexity of jump search is O(√n), where √n is the jump size, and Fibonacci search is another divide and conquer algorithm which bears similarities to both binary search and jump search. It gets its name because it uses Fibonacci numbers to calculate the block size or search range in each step. Fibonacci numbers start with zero and follow the pattern 0, 1, 1, 2, 3, 5, 8, 13, 21... where each element is the addition of the two numbers that immediately precede it. -The algorithm works with three Fibonacci numbers at a time. +The algorithm works with three Fibonacci numbers at a time. The time complexity for Fibonacci search is O(log n); the same as binary search. This means the algorithm is faster than both linear search and jump search in most cases. @@ -79,4 +79,3 @@ Interpolation search works best on uniformly distributed, sorted arrays. Whereas

- diff --git a/Python/Algorithms/SortingAlgorithms/README.md b/Python/Algorithms/SortingAlgorithms/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/SpiralMatrix/README.md b/Python/Algorithms/SpiralMatrix/README.md new file mode 100644 index 00000000..e69de29b diff --git a/Python/Algorithms/SearchingAlgorithms/searchalgos.png b/docs/assest/image/searchalgos.png similarity index 100% rename from Python/Algorithms/SearchingAlgorithms/searchalgos.png rename to docs/assest/image/searchalgos.png diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..8ae4e5e7 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,472 @@ +

+ website title image +

👉 A Collection of Algorithm And Data Structures in Cpp and Python 👈

+

+ +

+ + +github stars +github forks +code size +

+

+open issues +closed issues +open pull request +closed pull request +

+

+hacktoberfest +MIT license +

+

+discord invite +last contributions +total contributors +

+ + +- [AlgorithmsAndDataStructure](#algorithmsanddatastructure) + - [Introduction](#introduction) + - [Data Structure](#data-structure) + - [Algorithms](#algorithms) + - [Support](#support) + - [Contributing](#contributing) + - [Authors and acknowledgment](#authors-and-acknowledgment) + - [License](#license) + - [Project status](#project-status) + - [Maintainers](#maintainers) + +#Note +~~We have enabled an Interaction Limit till Monday(5th October). This is because we received a lot of duplicate issues and spam PRs, so we need some time to label them as invalid.~~ +We are now open to everyone again! + +## Introduction + +Data structures & Algorithms are an essential part of programming. It comes under the fundamentals of computer science. It gives us the advantage of writing better and efficient code in less time. It is a key topic when it comes to Software Engineering interview questions so as developers, we must have knowledge of Data Structure and Algorithms + +:star2: Star it +:fork_and_knife:Fork it +:handshake: Contribute to it! + + +## Data Structure + +In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. +Data structure is a way or a format how your data is stored in memory for effecient usage and retrieval. + +## Algorithms + +An algorithm is a set of instructions that are used to accomplish a task, such as finding the largest number in a list, removing all the red cards from a deck of playing cards, sorting a collection of names, figuring out an average movie rating from just your friend's opinion + +Algorithms are not limited to computers. They are like a set of step-by-step instructions or an even a recipe, containing things you need, steps to do, the order to do them, conditions to look for, and expected results. + +## Languages +- C++ +- Python + +## Support + +Check [Contribution](/CONTRIBUTING.md) Guide Before Contribution. + +## Project Progress + +

Data Structures

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Data StructureC++PythonStatus/Remarks
Linked ListYesYesBeing improved #23
SetsYesYesImplemented
StackYesIn progress #13
QueueIn progress #7In progress #12
+ +
+ +

Algorithms

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AlgorithmC++PythonRemarks
Searching
Binary SearchNoIn progress #9
Jump SearchIn progress #39In progress #10
Fibonacci SearchNoIn progress #11
Sorting
Selection SortIn progress #29In progress #30
Bubble SortYesYes
Insertion SortIn progress #2Yes
Merge SortIn progress #3Yes
Quick SortIn progress #4Yes
Heap SortIn progress #5In progress #6
Radix SortIn progress #63Yes
Recursion
Fibonacci NumbersNoYes
Fibonacci ListNoYes
FactorsNoYes
RecursionNoYes
Recursive SumNoYes
Sieve
Sieve of ErosothenesNoYes
Dynamic Programming
Knapsack ProblemNoYes
Longest Common SubsequenceNoYes
Longest Increasing SubsequenceNoYes
Merge SortNoYesDuplicate
Fibonacci NumberNoYesDuplicate
Naive Pattern SearchIn progress #18In progress #17
Rabin-Karp AlgorithmNo
Backtracking
Suduko SolverIn progress #21No
The Knight's TourIn progress #33In progress #32
Subset SumIn progress #36In progress #35
Deep Learning
Activation FunctionNoYes
Feed Forward Normal FunctionNoYes
LayersNoYes
Loss FunctionNoYes
OptimizersNoYes
Machine Learning
Gradient DescentNoYes
Linear RegressionNoYes
Logistic RegressionNoYes
Decision TreeNoIn progress #37
K-Nearest NeighboursNoIn progress #38
+
+ +

Contributing

+ +Before submitting a bug, please do the following: +Check [Contribution](/CONTRIBUTING.md) Guide Before Contribution. + +- Create separate issues for Python and C++. +- You can only work on issues that you have been assigned to. +- Use Flake8 locally for linting Python Code. `pip install flake8`. + (We have linting checks so if your code fails it we will not merge the PR.) + +## Authors and acknowledgment + +Show your appreciation to those who have contributed to the project. + +## [License](/LICENSE) + +For open-source projects, Under [MIT License](/LICENSE). + +

Maintainers

+ +- [CodePerfectPlus](https://github.com/codePerfectPlus) +- [ExpressHermes](https://github.com/ExpressHermes) +- [Ayush Modi](https://github.com/hot9cups) +- [rex_divakar](https://github.com/rexdivakar) +- [Shubham Pawar](https://github.com/shubham5351) +- [Shantanu Kale](https://github.com/SSKale1) + +

+built by developers +