Ayush Gupta has Published 530 Articles

Program to print nodes between two given level numbers of a binary tree using C++

Ayush Gupta

Ayush Gupta

Updated on 01-Nov-2019 06:12:35

159 Views

In this tutorial, we will be discussing a program to print nodes between the two given level numbers of a binary tree.In this, we will be given a low level and a high level for a particular binary tree and we have to print all the elements between the given ... Read More

C++ program to find ΔX which is added to numerator and denominator both of fraction (a/b) to convert it to another fraction (c/d)

Ayush Gupta

Ayush Gupta

Updated on 03-Oct-2019 12:30:47

109 Views

In this article, we will be discussing a program to find ΔX which is added to the numerator and denominator both of given fraction (a/b) to convert it to another given irreducible fraction (c/d).For example, let us suppose we have been given with the following values, a = 4 | ... Read More

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

185 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

390 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

164 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

471 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

2K+ 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

152 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

130 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

269 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

Advertisements