Showing posts with label Algorithm. Show all posts
Showing posts with label Algorithm. Show all posts
Maximum Number of Points in a Line
Resources:
wikipedia.org ==>> Collinearity
GFG
How To Determine If Points Are Collinear In Coordinate Geometry?
Collinear
Maximum Number of Points in a Line
Implementation basis Spoj & Codechef problem:
A* search algorithm
Resources:
wikipedia.org ==> A*_search_algorithm
hackerearth blog
GFG
stanford.edu
hackerrank Problems
implementation from Youtube Video:
Expression parsing
Resources:
Cp_Algorothm
Problem Link:
1309 - Children`s Math
1324 - Equivalent Boolean Expressions
Implementation:
Longest Increasing Subsequence (LIS)
Resource:
Longest Increasing Subsequence (GFG)
LIS and variation
āĻĄাāĻāύাāĻŽিāĻ āĻĒ্āϰোāĻ্āϰাāĻŽিং āĻ āĻšাāϤেāĻā§ি-ā§Ē
Problem:
990 - Diving for Gold
1501. Sense of Beauty
1167. Bicolored Horses
231 - Testing the CATCHER
10926 - How Many Dependencies?
10000 - Longest Paths
XMEN SOLUTTION
10635 - Prince and Princess
1277 - Looking for a Subsequence SOLUTION
Code:
Longest Common Subsequence ( LCS )
Topological Sorting
Resource Link
Topological Sorting (E-Maxx)
Kahn’s algorithm for Topological Sorting
Topological Sorting
TopSort using DFS:
TopSort using BFS: (Kahn’s algorithm)
F1. Tree Cutting (Easy Version
F1. Tree Cutting (Easy Version)
Topic: DFS
Concept: āĻĒ্āϰāϤিāĻা āĻĒ্āϝাāϰেāύ্āĻ āĻāϰ āĻাāĻāϞ্āĻĄ āĻোāύ āĻোāύ āĻাāϞাāϰ āĻāĻে āϤাāϰ āĻšিāϏাāĻŦ āϰাāĻāĻŦো, āϝেāĻŽāύ āĻĒ্āϰāĻĨāĻŽ āĻāĻĻাāĻšāϰāύে -
ā§§ āύং āύোāĻĄেāϰ āĻাāĻāϞ্āĻĄ āĻāϰ āϏংāĻ্āϝা āĻšāĻŦে ā§§āĻা āϞাāϞ, ⧍āĻা āύীāϞ , ā§§āĻা āύāϰāĻŽাāϞ।
⧍ āύং āύোāĻĄেāϰ āĻাāĻāϞ্āĻĄ āĻāϰ āϏংāĻ্āϝা āĻšāĻŦে ā§§āĻা āϞাāϞ, ā§§āĻা āύীāϞ , ⧍āĻা āύāϰāĻŽাāϞ।
ā§Š āύং āĻāϰ ā§§āĻা āύāϰāĻŽাāϞ (āύিāĻেāϰ āĻাāϞাāϰ)।
ā§Ē āύং āύোāĻĄেāϰ āĻাāĻāϞ্āĻĄ āĻāϰ āϏংāĻ্āϝা āĻšāĻŦে ā§§āĻা āϞাāϞ ( āĻāĻāĻা āĻŦাāĻĻ āĻĻিā§ে āĻāύ্āϏাāϰ āĻĒাāĻŦ)।
ā§Ģ āύং āύোāĻĄেāϰ āĻাāĻāϞ্āĻĄ āĻāϰ āϏংāĻ্āϝা āĻšāĻŦে 1āĻা āύীāϞ।
Solution 01:
Bucket Sort
Bucket Sort
geeksforgeeks
hackerearth
visualization
Time Complexity: If we assume that insertion in a bucket takes O(1) time then steps 1 and 2 of the above algorithm clearly take O(n) time. The O(1) is easily possible if we use a linked list to represent a bucket (In the following code, C++ vector is used for simplicity). Step 4 also takes O(n) time as there will be n items in all buckets.
Heap Sort
Heap Sort
Time Complexity: Time complexity of heapify is O(nLogn). Time complexity of createAndBuildHeap() is O(n) and overall time complexity of Heap Sort is O(nLogn).