
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 36 Articles for Misc Algorithms

4K+ Views
Jarvis March algorithm is used to detect the corner points of a convex hull from a given set of data points.Starting from a leftmost point of the data set, we keep the points in the convex hull by anti-clockwise rotation. From a current point, we can choose the next point by checking the orientations of those points from the current point. When the angle is largest, the point is chosen. After completing all points, when the next point is the start point, stop the algorithm.Input and OutputInput: Set of points: {(-7, 8), (-4, 6), (2, 6), (6, 4), (8, 6), ... Read More

7K+ Views
The convex hull is the minimum closed area which can cover all given data points.Graham’s Scan algorithm will find the corner points of the convex hull. In this algorithm, at first, the lowest point is chosen. That point is the starting point of the convex hull. Remaining n-1 vertices are sorted based on the anti-clockwise direction from the start point. If two or more points are forming the same angle, then remove all points of the same angle except the farthest point from start.From the remaining points, push them into the stack. And remove items from stack one by one, ... Read More

1K+ Views
All even numbers from 4, can be expressed as a sum of two prime numbers. Sometimes a number can have more than one sum of the prime number combination.For an example the number 10 = (5 + 5) and (7 + 3)This algorithm will find all of the combinations of prime sums for a given number. When one number x is prime, then only we will check whether (number - x) is prime or not, if yes, the sum of x and (number – x) represents the even number.Input and OutputInput: Even number: 70 Output: Prime sums 70 = 3 ... Read More

1K+ Views
One matrix is given; the matrix is representing the one screen. Each element (i, j) of the screen is denoted as a pixel, the color of that pixel is marked with different numbers. In this algorithm, the pixels will be filled with new color when it is already in selected previous color. If the previous color is not the previous color, that pixel will not be filled. After filling a pixel, it will check for its up, down, left and right pixels to do the same.The idea is really simple, first, we check whether the selected position is colored with ... Read More

2K+ Views
This algorithm will convert a given number into English words. Like 564 will be Five Hundred and Sixty-Four. For this algorithm, some predefined strings are given, from that list, it will get the proper words to make into words.The lists are like Units: it will hold all words for (0 to 9) like Zero, One…Nine twoDigits: it will hold all numbers from (10 - 19), like Ten, eleven…NineteentenMul: For ten multiples, (20-90), like Twenty, Thirty, … Ninety.tenPower: It is for Hundred and Thousands as power 2 and 3 of 10Input and OutputInput: The number: 568 Output: Five Hundred And Sixty EightAlgorithmnumToWord(num)there are some ... Read More

620 Views
Two numbers are given as a binary string, our task is to find the result of multiplication for those numbers in a faster and efficient way.Using the Divide and Conquer strategy, we can solve the problem, in a very efficient manner. We will split the numbers into two halves.let Xleft and Xright are two parts of first number X, and Yleft, Yright are two parts of second number Y. So the product;To make it simple, we can perform this operationInput and OutputInput: Two binary numbers: 1101 and 0111 Output: The result is: 91AlgorithmaddBitString(num1, num2)Input: Two numbers to add.Output: The result after ... Read More

352 Views
A directed graph is given. Another two vertices u and v are also given, u is the starting vertex, and v is the ending vertex. Our task is to find a number of walks from vertex u to v with exactly k edges. The value of k is also provided in the algorithm.By using dynamic programming, we need to create a 3D table, Where the row will point the values of u, columns will point the values v and depth will be used to track the number of edges from start to end.Input and OutputInput: The adjacency matrix of the ... Read More

2K+ Views
Roman numbers are non-positional numbers. Some numerals are placed together to form a number in roman numbers. For an example the number 75 can be expressed as 75 = 50 + 10 + 10 + 5, so the roman numerals are LXXV.In this problem one number is provided in a decimal format, our task is to convert it into the Roman numeral strings.There are different symbols and their value, like this.IIVVIXXXLLXCCCDDCMMMMMMV’145910405090100400500900100040005000Using this table, we can easily find the roman numerals of a given number.Input and OutputInput: Decimal number: 3569 Output: The Roman equivalent of 3569 is: MMMDLXIXAlgorithmdecToRoman(nuList, num)Input: The numeral list ... Read More

860 Views
There are N ropes of given lengths. We have to connect with them. The cost of connecting one rope with other is the sum of their lengths. Our goal is to connect the N ropes with minimum cost.This problem can be solved using a heap tree. We will create min heap to insert all different lengths first, then remove minimum and second minimum item from min heap, connect them and again insert into the heap tree. When the heap will hold only one element, we can stop the process and get the connected rope with minimum costs.Input and OutputInput: The ... Read More

3K+ Views
Three points of a triangle are given; another point P is also given to check whether the point P is inside the triangle or not.To solve the problem, let consider the points of the triangle are A, B, and C. When the area of triangle Δ𝐴𝐵𝐶 = Δ𝐴𝐵𝑃 + Δ𝑃𝐵𝐶 + Δ𝐴𝑃𝐶, then the point P is inside the triangle.Input and OutputInput: Points of the triangle {(0, 0), (20, 0), (10, 30)} and point p (10, 15) to check. Output: Point is inside the triangle.AlgorithmisInside(p1, p2, p3, p)Input: Three points of a triangle, the point p to check.Output: True, when ... Read More