
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 1860 Articles for Data Structure

3K+ Views
A number is said to be a perfect square number if the square root of that number is an integer. In other words, when a square root is a whole number, then the number is called a perfect square number.We can check perfect square by finding the square root of that number and match with i again and again to get exact square root. When the square root crosses the value, it is not a perfect square number.But here to reduce effort, we have not checked the square root again and again. As we know that the square root of ... Read More

3K+ Views
In this problem, one polygon is given, and a point P is also given. We need to check whether the point is inside the polygon or outside the polygon.For solving it we will draw a straight line from the point P. It extends to the infinity. The line is horizontal, or it is parallel to the x-axis.From that line, we will count how many times the line intersects the sides of a polygon. When the point is inside the polygon, it will intersect the sides, an odd number of times, if P is placed on any side of the polygon, ... Read More

2K+ Views
In computers, variables are stored in memory locations. But the size of the memory location is fixed, so when we try to find the factorial of some greater value like 15! or 20! the factorial value exceeds the memory range and returns wrong results.For calculation of large numbers, we have to use an array to store results. In each element of the array, is storing different digits of the result. But here we cannot multiply some number with the array directly, we have to perform manual multiplication process for all digits of the result array.Input and OutputInput: A big number: ... Read More

4K+ Views
The Babylonian method to find square root is based on one of the numerical method, which is based on the Newton- Raphson method for solving non-linear equations.The idea is simple, starting from an arbitrary value of x, and y as 1, we can simply get next approximation of root by finding the average of x and y. Then the y value will be updated with number / x.Input and OutputInput: A number: 65 Output: The square root of 65 is: 8.06226AlgorithmsqRoot(number)Input: The number in real.Output: Square root of given number.Begin x := number y := 1 precision ... Read More

403 Views
Deterministic Finite Automaton(DFA) is used to check whether a number is divisible by another number k or not. If it is not divisible, then this algorithm will also find the remainder.For the DFA based division, at first, we have to find the transition table of the DFA, using that table, we can easily find the answer. In the DFA, each state has only two transition 0 and 1.Input and OutputInput: The number: 50 and the divisor 3 Output: 50 is not divisible by 3 and remainder is: 2AlgorithmdfaDivision(num, k)Input: A number num, and divisor k.Output: Check divisibility and the remainder.Begin ... Read More

2K+ Views
In mathematics, Greatest Common Divisor (GCD) is the largest possible integer, that divides both of the integers. The condition is that the numbers must be non-zero.We will follow the Euclidean Algorithm to find the GCD of two numbers.Input and OutputInput: Two numbers 51 and 34 Output: The GCD is: 17AlgorithmfindGCD(a, b)Input: Two numbers a and b.Output: GCD of a and b.Begin if a = 0 OR b = 0, then return 0 if a = b, then return b if a > b, then return findGCD(a-b, b) ... Read More

1K+ Views
In mathematics Least Common Multiple (LCM) is the smallest possible integer, that is divisible by both numbers.LCM can be calculated by many methods, like factorization, etc. but in this algorithm, we have multiplied the bigger number with 1, 2, 3…. n until we find a number which is divisible by the second number.Input and OutputInput: Two numbers: 6 and 9 Output: The LCM is: 18AlgorithmLCMofTwo(a, b)Input: Two numbers a and b, considered a > b.Output: LCM of a and b.Begin lcm := a i := 2 while lcm mod b ≠ 0, do lcm := ... Read More

1K+ Views
A decimal number can also be converted into its binary form. To convert a decimal number to binary number, we need to divide the number by 2 until it reaches 0 or 1. And in each step, the remainder are stored separately to form the binary equivalent number in reverse order.In this algorithm, we will follow the recursive approach. It will help us to solve the problem without using stack data structure. In the implementation, we know that recursion of a function will follow the internal stack. We will serve our job by using that stack.Input and OutputInput: Decimal number ... Read More

2K+ Views
Lucky numbers are some special integer numbers. From basic numbers, some special numbers are eliminated by their position. Instead of their value, for their position, the numbers are eliminated. The numbers which are not deleted, they are the lucky numbers.The number deletion follows some rule. At first, every second number are deleted, after that, all 3rd numbers are deleted and so on.Here is some example −1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 (1 – 25 all) 1 3 5 7 9 11 ... Read More

1K+ Views
For constructing new data points within a range of a discrete set of given data point, the interpolation technique is used. Lagrange interpolation technique is one of them. When the given data points are not evenly distributed, we can use this interpolation method to find the solution. For the Lagrange interpolation, we have to follow this equation.Input and OutputInput: List of x and f(x) values. find f(3.25) x: {0, 1, 2, 3, 4, 5, 6} f(x): {0, 1, 8, 27, 64, 125, 216} Output: Result after Lagrange interpolation f(3.25) = 34.3281AlgorithmlargrangeInterpolation(x: array, fx: array, x1)Input − x array and fx ... Read More