Samual Sam has Published 2310 Articles

Travelling Salesman Problem

Samual Sam

Samual Sam

Updated on 17-Jun-2020 09:50:16

2K+ Views

One sales-person is in a city, he has to visit all other cities those are listed, the cost of traveling from one city to another city is also provided. Find the route where the cost is minimum to visit all of the cities once and return back to his starting ... Read More

Check if two line segments intersect

Samual Sam

Samual Sam

Updated on 17-Jun-2020 09:40:21

5K+ Views

Let two line-segments are given. The points p1, p2 from the first line segment and q1, q2 from the second line segment. We have to check whether both line segments are intersecting or not.We can say that both line segments are intersecting when these cases are satisfied:When (p1, p2, q1) ... Read More

Fastest Way to multiply two Numbers

Samual Sam

Samual Sam

Updated on 17-Jun-2020 09:35:14

672 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 ... Read More

Graham Scan Algorithm

Samual Sam

Samual Sam

Updated on 17-Jun-2020 09:26:16

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 ... Read More

DFA based division

Samual Sam

Samual Sam

Updated on 17-Jun-2020 09:23:06

406 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, ... Read More

Trapezoidal Rule for definite integral

Samual Sam

Samual Sam

Updated on 17-Jun-2020 08:48:56

1K+ Views

Definite integrals can be solved using this trapezoidal rule. To integrate a function f(x) between the range a to b is basically finding the area below the curve from point x = a to x = b. To find that area, we can divide the area into n trapezoids, and the ... Read More

Runge-Kutta 4th order rule for differential equation

Samual Sam

Samual Sam

Updated on 17-Jun-2020 08:37:44

2K+ Views

Runge Kutta method is used for solving ordinary differential equations (ODE). It uses dy/dx function for x and y, and also need the initial value of y, i.e. y(0). It finds the approximate value of y for given x. For solving ODE, we have to follow these formulas:Here h is ... Read More

Find LCM of two numbers

Samual Sam

Samual Sam

Updated on 17-Jun-2020 08:19:33

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 ... Read More

Rod Cutting

Samual Sam

Samual Sam

Updated on 17-Jun-2020 08:11:06

7K+ Views

A rod is given of length n. Another table is also provided, which contains different size and price for each size. Determine the maximum price by cutting the rod and selling them in the market.To get the best price by making a cut at different positions and comparing the prices ... Read More

Convert Infix to Prefix Expression

Samual Sam

Samual Sam

Updated on 17-Jun-2020 07:51:44

7K+ Views

To solve expressions by the computer, we can either convert it in postfix form or to the prefix form. Here we will see how infix expressions are converted to prefix form.At first infix expression is reversed. Note that for reversing the opening and closing parenthesis will also be reversed.for an ... Read More

Advertisements