All Projects → Harshita-Kanal → Data-Structures-and-algorithms

Harshita-Kanal / Data-Structures-and-algorithms

Licence: other
This repository would be a documentation of my journey towards learning Data structures and algorithms. Please ⭐ this repo if you liked the effort 😄

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Data-Structures-and-algorithms

CBJ Smart-Device Resources
🧰 Have you ever wondered if there is an open-source project to make your own smart home?, cause you just found part of one!. This part is in charge of general resources like instructions to prepare the smart devices.
Stars: ✭ 18 (-18.18%)
Mutual labels:  hacktoberfest2020
HacktoberFest2021
hacktoberfest-accepted repository
Stars: ✭ 25 (+13.64%)
Mutual labels:  hacktoberfest2020
ui-design-daily
abdulqudus001.github.io/ui-design-daily/
Stars: ✭ 21 (-4.55%)
Mutual labels:  hacktoberfest2020
Algoflow
Algorithm Visualizer
Stars: ✭ 21 (-4.55%)
Mutual labels:  hacktoberfest2020
Inheritance-2020
Official Repository for Inheritance Submissions 2020
Stars: ✭ 18 (-18.18%)
Mutual labels:  hacktoberfest2020
Web-App
A Web Application foundation for Raku
Stars: ✭ 21 (-4.55%)
Mutual labels:  hacktoberfest2020
Recursion-Tree-Visualizer
A simple python package that helps to visualise any recursive function by adding a single line of code.
Stars: ✭ 89 (+304.55%)
Mutual labels:  hacktoberfest2020
Plasma-Donor-App
An open-source app that helps in connecting patients and plasma donors. This is a beginner-friendly repository that helps you learn the basics of android development, git, and GitHub. Happy Hacktober!
Stars: ✭ 58 (+163.64%)
Mutual labels:  hacktoberfest2020
Hacktoberfest-2020-Baby
No description or website provided.
Stars: ✭ 31 (+40.91%)
Mutual labels:  hacktoberfest2020
Logan1x.github.io
Personal Portfolio Website 🌐
Stars: ✭ 122 (+454.55%)
Mutual labels:  hacktoberfest2020
Hacktoberfest-Algorithms
This repository is mainly open to those who are looking to make some PRs for the Hacktoberfest 2020 event. In this repository, you can add programs on some useful algorithms for Competitive Programming in any languages.
Stars: ✭ 47 (+113.64%)
Mutual labels:  hacktoberfest2020
Footnote
Simple SwiftUI + CoreData app
Stars: ✭ 38 (+72.73%)
Mutual labels:  hacktoberfest2020
Geektoberfest-Main
This is the starting point of Geektoberfest! Have a look at the readme for Rules and Guidelines, you can also contribute to the collaborative website in this repo!
Stars: ✭ 12 (-45.45%)
Mutual labels:  hacktoberfest2020
godot tools
A set of GDScript EditorScript and EditorPlugins tools that automate boring tasks on Godot Engine.
Stars: ✭ 50 (+127.27%)
Mutual labels:  hacktoberfest2020
DockerENT
The only open-source tool to analyze vulnerabilities and configuration issues with running docker container(s) and docker networks.
Stars: ✭ 124 (+463.64%)
Mutual labels:  hacktoberfest2020
spamtoberfest
Fight against PR spammers
Stars: ✭ 51 (+131.82%)
Mutual labels:  hacktoberfest2020
hello-world-all-programming-language
This is a repository of examples of hello world programs in all programming languages
Stars: ✭ 23 (+4.55%)
Mutual labels:  hacktoberfest2020
laravel-thumbnails
Laravel Package for making thumbnails instantly
Stars: ✭ 51 (+131.82%)
Mutual labels:  hacktoberfest2020
ray-tracer
My ongoing effort to learn how to make Ray Tracers
Stars: ✭ 14 (-36.36%)
Mutual labels:  hacktoberfest2020
o-fish-ios
iOS app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Stars: ✭ 28 (+27.27%)
Mutual labels:  hacktoberfest2020

Data-Structures-and-algorithms

Hello World! 👋

This repository will be my documentation while I learn Data structures and algorithms. I will add my solved problems here 😄

Binary Search

https://www.topcoder.com/community/competitive-programming/tutorials/binary-search/

Beyond arrays: the discrete binary search

This is where we start to abstract binary search. A sequence (array) is really just a function which associates integers (indices) with the corresponding values. However, there is no reason to restrict our usage of binary search to tangible sequences. In fact, we can use the same algorithm described above on any monotonic function f whose domain is the set of integers. The only difference is that we replace an array lookup with a function evaluation: we are now looking for some x such that f(x) is equal to the target value. The search space is now more formally a subinterval of the domain of the function, while the target value is an element of the codomain. The power of binary search begins to show now: not only do we need at most O(log N) comparisons to find the target value, but we also do not need to evaluate the function more than that many times. Additionally, in this case we aren’t restricted by practical quantities such as available memory, as was the case with arrays.

What we can call the main theorem states that binary search can be used if and only if for all x in S, p(x) implies p(y) for all y > x. This property is what we use when we discard the second half of the search space. It is equivalent to saying that ¬p(x) implies ¬p(y) for all y < x (the symbol ¬ denotes the logical not operator), which is what we use when we discard the first half of the search space. The theorem can easily be proven, although I’ll omit the proof here to reduce clutter.

These two parts are most often interleaved: when we think a problem can be solved by binary search, we aim to design the predicate so that it satisfies the condition in the main theorem.

Floyd's cycle-finding algorithm

Floyd's cycle-finding algorithm is a pointer algorithm that uses only two pointers, which move through the sequence at different speeds. It is also called the "tortoise and the hare algorithm", alluding to Aesop's fable of The Tortoise and the Hare.

The algorithm is named after Robert W. Floyd, who was credited with its invention by Donald Knuth.[3][4] However, the algorithm does not appear in Floyd's published work, and this may be a misattribution: Floyd describes algorithms for listing all simple cycles in a directed graph in a 1967 paper,[5] but this paper does not describe the cycle-finding problem in functional graphs that is the subject of this article. In fact, Knuth's statement (in 1969), attributing it to Floyd, without citation, is the first known appearance in print, and it thus may be a folk theorem, not attributable to a single individual.[6]

The key insight in the algorithm is as follows. If there is a cycle, then, for any integers i ≥ μ and k ≥ 0, xi = xi + kλ, where λ is the length of the loop to be found and μ is the index of the first element of the cycle. Based on this, it can then be shown that i = kλ ≥ μ for some k if and only if xi = x2i. Thus, the algorithm only needs to check for repeated values of this special form, one twice as far from the start of the sequence as the other, to find a period ν of a repetition that is a multiple of λ. Once ν is found, the algorithm retraces the sequence from its start to find the first repeated value xμ in the sequence, using the fact that λ divides ν and therefore that xμ = xμ + v. Finally, once the value of μ is known it is trivial to find the length λ of the shortest repeating cycle, by searching for the first position μ + λ for which xμ + λ = xμ.

The algorithm thus maintains two pointers into the given sequence, one (the tortoise) at xi, and the other (the hare) at x2i. At each step of the algorithm, it increases i by one, moving the tortoise one step forward and the hare two steps forward in the sequence, and then compares the sequence values at these two pointers. The smallest value of i > 0 for which the tortoise and hare point to equal values is the desired value ν.

A* Algorithm

A* algorithm is used to find the shortest path in a grapg/tree. As it uses an heuristic to guide the search. The algorithm starts from an initial start node, expands neighbors and updates the full path cost of each neighbor. It selects the neighbor with the lowest cost and continues until it finds a goal node, this can be implemented with a priority queue or by sorting the list of open nodes in ascending order. It is important to select a good heuristic to make A* fast in searches, a good heuristic should be close to the actual cost but should not be higher than the actual cost.

A* is complete and optimal, it will find the shortest path to the goal. A good heuristic can make the search very fast, but it may take a long time and consume a lot of memory in a large search space. The time complexity is O(n) in a grid and O(b^d) in a graph/tree with a branching factor (b) and a depth (d). The branching factor is the average number of neighbor nodes that can be expanded from each node and the depth is the average number of levels in a graph/tree.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].