Algorithm paradigm | Introduction to Divide and conquer algorithm

Divide and conquer algorithm Divide and conquer (D&C) is an algorithm design paradigm based on multi-branched recursion. A divide and conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined … Continue reading Algorithm paradigm | Introduction to Divide and conquer algorithm

Advertisements

Java program to find LCM of given array

Least Common Multiple (LCM) of two numbers is the smallest number which can be divided by both numbers. or The smallest positive number that is a multiple of two or more numbers. Let's start with an Example ... List the multiples of each number, Least Common Multiple (LCM) of 15 and 20: The multiples of … Continue reading Java program to find LCM of given array

Java program to find LCM of two numbers

Least Common Multiple (LCM) of two numbers is the smallest number which can be divided by both numbers. or The smallest positive number that is a multiple of two or more numbers. Let's start with an Example ... List the multiples of each number, Least Common Multiple (LCM) of 15 and 20: The multiples of … Continue reading Java program to find LCM of two numbers

Tower of Hanoi implementation in java

The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower  and sometimes pluralized) is a mathematical game or puzzle. It consists of three rods and a number of disks of different sizes, which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of … Continue reading Tower of Hanoi implementation in java

Java Program to Implement Euclid GCD Algorithm using Recursion

The Euclidean algorithm calculates the greatest common divisor (GCD) of two number a and b. The greatest common divisor g is the largest natural number that divides both a and b without leaving a remainder. Synonyms for the GCD include the greatest common factor (GCF), the highest common factor (HCF), the highest common divisor (HCD), … Continue reading Java Program to Implement Euclid GCD Algorithm using Recursion

java program to find n-th fibonacci number using recursion

The Fibonacci numbers are the numbers in the following integer sequence called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones: The fibonacci series is defined as follows: 0,1 , 1 , 2 , 3 , 5 , 8 , 13 … Continue reading java program to find n-th fibonacci number using recursion

Java program to find factorial of given number using recursion

Recursion  is a method where the solution to a problem depends on solutions to smaller instances of the same problem.One of the classic problems for introducing recursion is calculating the factorial of an integer. The factorial of any given integer — call it n  — is the product of all the integers from 1 to … Continue reading Java program to find factorial of given number using recursion