Found 26504 Articles for Server Side Programming

Evaluate a Laguerre series at points x with multidimensional coefficient array in Python

AmitDiwan
Updated on 02-Mar-2022 07:15:28

141 Views

To evaluate a Laguerre series at points x, use the polynomial.laguerre.lagval() method in Python Numpy. The 1st parameter is x. If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, x or its elements must support addition and multiplication with themselves and with the elements of c.The 2nd parameter, C, an array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the ... Read More

C++ Program to check if two stacks of letters can be emptied or not

Arnab Chakraborty
Updated on 02-Mar-2022 07:41:49

179 Views

Suppose, there are 2n number of letters and each of them has an integer number between 1 to n written on them. There are exactly two letters that have the same number written on them. These letters are arranged into m stacks and stack i has letters stack[i] on it. Our task is to empty all the stacks in the following mannerWe have to choose any two stacks and remove the top letter from both of them.The letters that we have removed must have the same number on both of them.If we can empty the m stacks in this manner, ... Read More

Evaluate a Laguerre series at list of points x in Python

AmitDiwan
Updated on 02-Mar-2022 07:13:48

178 Views

To evaluate a Laguerre series at points x, use the polynomial.laguerre.lagval() method in Python Numpy. The 1st parameter is x. If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, x or its elements must support addition and multiplication with themselves and with the elements of c.The 2nd parameter, C, an array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the ... Read More

C++ Program to find out the maximum amount of money that can be made from selling cars

Arnab Chakraborty
Updated on 02-Mar-2022 07:17:43

304 Views

Suppose, there is a demand for red and blue cars for sale. An automobile company decides to sell p red cars and q blue cars of different prices. Currently, the company has 'a' number of red cars, 'b' number of blue cars, and 'c' numbers of colorless cars (the cars are yet to be painted) in their stock. The values of the different cars are given in arrays A, B, and C. So, the company has to sell p + q number of cars in a day and they have to make maximum profit from them. The colorless cars can ... Read More

C++ program to check if two images match after rotation and translation

Arnab Chakraborty
Updated on 02-Mar-2022 07:09:04

244 Views

Suppose, there are two n * n pixel square images first and second. The pixels can either be black or white. The images are given in a matrix representation where if a pixel is black it is represented as 'x' and if it is white, it is represented as '.'. We have to check the second image matches with the first image after 90° rotations and translations. If it does we return true, otherwise, we return false.So, if the input is like n = 4, first = {"..x.", "x.x.", "x.xx", "xx.."}, second = {"..xx", "x.xx", ".x.x", "..x."}, then the output ... Read More

Evaluate a Laguerre series at tuple of points x in Python

AmitDiwan
Updated on 02-Mar-2022 07:11:05

123 Views

To evaluate a Laguerre series at points x, use the polynomial.laguerre.lagval() method in Python Numpy. The 1st parameter is x. If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, x or its elements must support addition and multiplication with themselves and with the elements of c.The 2nd parameter, C, an array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the ... Read More

C++ Program to find out the maximum amount of score that can be decreased from a graph

Arnab Chakraborty
Updated on 02-Mar-2022 06:59:39

336 Views

Suppose, there is a weighted, undirected graph that has n vertices and m edges. The score of the graph is defined as the addition of all the edges weights in the graph. The edge weights can be negative, and if they are removed the score of the graph increases. What we have to do, we have to make the score of the graph minimum by removing the edges from the graph while keeping the graph connected. We have to find out the maximum amount of score that can be decreased.The graph is given in an array 'edges', where each element ... Read More

C++ Program to find out the number of cells to block in a grid to create a path

Arnab Chakraborty
Updated on 02-Mar-2022 06:54:00

414 Views

Suppose, there is a grid of dimensions h * w. There is a robot in cell position (0, 0) and it has to go to the position (h - 1, w - 1). There are two types of cells in a grid, blocked and unblocked. The robot can pass through the unblocked cells but cannot pass through the blocked cells. The robot can go in four directions; it can go left, right, up, and down. But the robot may go in any direction from a cell to another (ignoring the previous cell it was in), so we have to make ... Read More

C++ to perform certain operations on a sequence

Arnab Chakraborty
Updated on 02-Mar-2022 06:47:04

425 Views

Suppose, we are given an empty sequence and n queries that we have to process. The queries are given in the array queries and they are in the format {query, data}. The queries can be of the three following types−query = 1: Add the supplied data to the end of the sequence.query = 2: Print the element at the beginning of the sequence. After that delete the element.query = 3: Sort the sequence in ascending order.Note that, query types 2 and 3 always have data = 0.So, if the input is like n = 9, queries = {{1, 5}, {1, ... Read More

C++ Program to find out the moves to read a point from another point in a 2D plane

Arnab Chakraborty
Updated on 02-Mar-2022 12:40:34

324 Views

Suppose, there are two points in a 2D plane a and b that have the coordinates (x1, y1) and (x2, y2) respectively. Currently, we are at point 'a' and we can move at a distance of 1 either vertically or horizontally. We move to point b from point a, then get back to point a, and we go to point b again. It is not allowed to move through the same points more than once except the points a and b. We have to find out the moves we will make in this whole trip, and output it. If we ... Read More

Advertisements