Sudhir sharma has Published 1148 Articles

Pick points from array such that minimum distance is maximized in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:00:07

257 Views

In this problem, we are given an array arr[] of n elements that represent N index positions and there are C magnets. Our task is to print all these magnets in such a way that the distance between the two nearest magnets is as large as possible.Let’s take an example ... Read More

Pierpont Prime in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:57:26

173 Views

In this problem, we are given a number n. Our task is to print all Pierpont prime numbers less than n.Pierpont Prime number is a special type of prime number that is of the form, p= 2i . 3k + 1.Where p is a prime number, and i and k ... Read More

Pipes and Cisterns in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:52:55

227 Views

Pipes and cisterns problem is a very common problem and is generally included in competitive exams. So, learning questions related to pipers and cisterns is important and you should know how to solve them as these are not too difficult to learn.Pipes and cisternsThese problems involve pipes that are used ... Read More

Place k elements such that minimum distance is maximized in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:45:21

1K+ Views

In this problem, we are given an array of n points that lie on the same line. Our task is to place k elements of the array in such a way that the minimum distance between them is maximized.Let’s take an example to understand the problem, Input − array = ... Read More

Place K-knights such that they do not attack each other in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:43:06

630 Views

In this problem, we are given three integer value K, N, M. our task is to place K knights in an NxM chessboard such that no two knights attack each other. There can be cases with 0 valid ways and also cases with multiple valid ways. You need to print ... Read More

Place N^2 numbers in matrix such that every row has an equal sum in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:39:25

227 Views

In this problem, we are given an integer value N. our task is to print numbers within the range (1, N2) in a 2D matrix of size NxN in such a way that the sum elements of each row are equal.Let’s take an example to understand the problem, Input − ... Read More

Point arbit pointer to greatest value right side node in a linked list in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 09:11:14

165 Views

In this problem, we are given a linked list with a value, link pointer and an arbitrary pointer. Our task is to make the arbitrary pointer point to point the largest value which is on the right side of it in the linked list.Let’s take an example to understand the ... Read More

Point Clipping Algorithm in Computer Graphics in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 09:07:48

827 Views

Computer graphics deals with drawing images and graphics on a computer screen. Here, we treat the screen as a 2-D coordinate system. This coordinate system starts from top-left (0, 0) and ends at bottom-right.Viewing plane is the area defined for drawing graphics in computer graphics. Or the visible area of ... Read More

Point to next higher value node in a linked list with an arbitrary pointer in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 09:03:36

238 Views

In this problem, we are given a linked list with a value, link pointer and an arbitrary pointer. Our task is to make the arbitrary pointer point to point the next large value in the list.Let’s take an example to understand the problem, Here, we can see 8 points to ... Read More

polar() function for complex number in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 08:59:48

834 Views

The polar function of complex numbers is used to return a complex number.The polar() function is defined in the complex header file in c++. It takes the magnitude and phase angle of a complex number and generates a complex number using these values.Syntaxpolar(mag, phase);Parameters − it takes two values are ... Read More

Advertisements