/algorithms

:fire: Some notebooks implementing algorithms

Primary LanguageJupyter NotebookMIT LicenseMIT

📓 algorithms

some algorithms implemented in python, cpp and javascript

🚀 Searching algorithms:

In computer science, a search algorithm is any algorithm which solves the search problem, namely, to retrieve information stored within some data structure, or calculated in the search space of a problem domain, either with discrete or continuous values.

  • 🔖 Binary Search:
    In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. The main idea of the algorithms is to divide the given sorted array A into two subarrays at each step and look for the key element K in one of two subarrays.
    (You can read the code "BinarySearch.ipynb" // Everything documented, commented.

  • 🔖 Linear Search:
    In this searching technique, we compare each array element with the key element (k), that we are looking for. It's a very simple algorithm, but you may need to check every element of the array. If the key element is presented in the array, then the search is successful, otherwise is not.
    (You can read the code "LinearSearch.ipynb" // Everything documented, commented)

  • 🔖 Jump Search:
    Jump search is a searching algorithms for sorted arrays. The basic idea is to check fewer elements(than linear algebra) by jumping ahead.
    (You can read the code "JumpSearch.ipynb" // Everything documented, commented)

🚀 Recursive algorithms:

A recursive algorithm is an algorithm which calls itself with "smaller (or simpler)" input values, and which obtains the result for the current input by applying simple operations to the returned value for the smaller (or simpler) input.

  • 🔖 Fibonacci Sequence:
    Recursion means "defining a problem in terms of itself". This can be a very powerful tool in writing algorithms. Recursion comes directly from Mathematics, where there are many examples of expressions written in terms of themselves. For example, the Fibonacci sequence is defined as: F(i) = F(i-1) + F(i-2) (You can read the cide "Fibonacci_Sequence.ipynb" // Everything documented, commented)

🚀 Backtracking algorithms:

Backtracking is a general algorithm for finding all solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate as soon as it determines that the candidate cannot possibly be completed to a valid solution.