Ayush Gupta has Published 541 Articles

C++ program to find whether there is a path between two cells in matrix

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:28:49

124 Views

In this article, we will be discussing a program to find whether there exists a path between two cells in a given matrix.Let us suppose we have been given a square matrix with possible values 0, 1, 2 and 3. Here, 0 means Blank Wall1 means Source2 means Destination3 means ... Read More

C++ program to find whether only two parallel lines contain all coordinates points or not

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:21:59

289 Views

In this article, we will be discussing a program to find whether only two parallel lines can hold all the given coordinates points.For this we will be given an array, such that the coordinates will be (i, arr[i]). Let us suppose we are given an array, arr = {2, 6, ... Read More

C++ program to find the vertex, focus and directrix of a parabola

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:18:03

85 Views

In this article, we will be discussing a program to find the vertex, focus and directrix of a parabola when the coefficients of its equation is given.Parabola is a curve whose all points on the curve are equidistant from a single point called focus.As we know the general equation for ... Read More

C++ program to find the probability of a state at a given time in a Markov chain

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:15:35

332 Views

In this article, we will be discussing a program to find the probability of reaching from the initial state to the final state in a given time period in Markov chain.Markov chain is a random process that consists of various states and the associated probabilities of going from one state ... Read More

C++ program to find the Parity of a number efficiently

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:10:44

1K+ Views

In this article, we will be discussing a program to find the parity of a given number N.Parity is defined as the number of set bits (number of ‘1’s) in the binary representation of a number.If the number of ‘1’s in the binary representation are even, the parity is called ... Read More

C++ program to find the number of triangles amongst horizontal and vertical line segments

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:07:05

108 Views

In this article, we will be discussing a program to find the number of triangles that can be formed by joining the intersection points of the given horizontal and vertical line segments.For example, let us say we had been given the following line segments. In this we have 3 intersection ... Read More

C++ program to find the first digit in product of an array of numbers

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:00:40

76 Views

In this article, we will be discussing a program to find the first digit in the product of the elements of the given array.For example, let us say we have been given an array.arr = {12, 5, 16}Then the product is of these elements would be 12*5*16 = 960. Therefore, ... Read More

C++ program to find the best fit rectangle that covers a given point

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 11:58:26

170 Views

In this article, we will be discussing a program to find the best fit rectangle that covers a given point.In this problem, we are given we the coordinates of a point (x, y) and a ratio of length/breadth = l/b (say). We have to find the coordinates of a rectangle ... Read More

C++ program to find sum of digits of a number until sum becomes single digit

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 11:55:00

508 Views

In this article, we will be discussing a program to find the sum of digits of a number until the sum itself becomes a single digit and cannot be done summation of further.For example, take the case of a number 14520. Adding the digits of this number we get 1 ... Read More

C++ program to find minimum vertex cover size of a graph using binary search

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 11:52:58

662 Views

In this article, we will be discussing a program to find the minimum vertex cover size of a given graph using binary search.Minimum vertex cover is a set of vertices of the given graph such that every edge in the graph is incident of either of the vertices in that ... Read More

Advertisements