Server Side Programming Articles - Page 2089 of 2650

C++ Balanced expression with replacement

sudhir sharma
Updated on 09-Jul-2020 05:51:04

419 Views

A balanced expression of parentheses is an expression that contains pairs of all sort of parentheses together in a correct order.this means that for every opening parentheses there is a closing parentheses in proper order of parentheses i.e. { }.let's take a few examples to understand the concept better −Expression − {([][]{})({}[]{})}Output − balancedExplanation − we can see that for every opening parentheses there is a closing parentheses. all the parentheses lying between an opening parentheses and closing parentheses in Pairs.Output − not balanceExplanation − there are some unordered pairs of parentheses which makes the the expression unbalanced.In this problem ... Read More

Balance pans using given weights that are powers of a number in C++ program

sudhir sharma
Updated on 09-Jul-2020 05:51:39

196 Views

STATEMENT − Balance pans using given weights that are powers of a number.DESCRIPTION − In this problem we are given a pan based weighing machine. we are given a weight T and some other weights whose values are powers of a number a. We need to balance the pans using the given weights.Now, based on this we have this equation, T + (some power of a) = (some other power of a)Now, we should remember that there is exactly one weight corresponding to a power value.Example, T = 12 : a = 4Using the below values, we can balance the ... Read More

Bakhshali Approximation for computing square roots in C program

sudhir sharma
Updated on 09-Jul-2020 05:52:06

721 Views

Bakhshali approximation is a method of computing the square root of a number which is not a perfect square. Now, lets brush-related terms to easily understand the concept.Square root of a number x is a number that satisfies the following condition, y2 = x.Perfect Square is a number whose square roots are w. For example 16 is perfect square as its roots are 4 and 4.There are multiple methods defined mathematically to find the square root of a number. In this tutorial, we are going to learn about Bakhshali approximation to find the square root of a number.It is a ... Read More

Introduction to Backtracking

sudhir sharma
Updated on 02-Nov-2023 00:22:40

27K+ Views

Backtracking is a technique based on algorithm to solve problem. It uses recursive calling to find the solution by building a solution step by step increasing values with time. It removes the solutions that doesn't give rise to the solution of the problem based on the constraints given to solve the problem.Backtracking algorithm is applied to some specific types of problems, Decision problem used to find a feasible solution of the problem.Optimisation problem used to find the best solution that can be applied.Enumeration problem used to find the set of all feasible solutions of the problem.In backtracking problem, the algorithm ... Read More

Array Representation Of Binary Heap

sudhir sharma
Updated on 13-Nov-2019 10:20:04

4K+ Views

The complete binary tree that follows the properties of heap ordering is called binary heap.Based on the ordering of binary heap, it can be of two types −min Heap is the heap in which the value of node is greater than or equal to the value of its parent node. The root node of min heap is smallest.max Heap is the heap in which the value of node is smaller than or equal to the value of its parent node. The root node of max heap is greatest.The values of binary heap is typically represented as an array. The array ... Read More

Uri.IsBaseOf(Uri) Method in C#

AmitDiwan
Updated on 13-Nov-2019 07:08:36

170 Views

The Uri.IsBaseOf() method in C# is used to determine whether the current Uri instance is a base of the specified Uri instance.SyntaxFollowing is the syntax −public bool IsBaseOf (Uri uri);Above, the parameter Uri is the specified Uri instance to test.ExampleLet us now see an example to implement the Uri.IsBaseOf() method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");       Console.WriteLine("URI = "+newURI1);       Uri newURI2 = new Uri("https://www.tutorialspoint.com/");       Console.WriteLine("URI = "+newURI2);       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs ... Read More

MathF.Ceiling() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:06:30

394 Views

The MathF.Ceiling() method in C# is used to find the smallest integer greater than or equal to the float value in the argument.SyntaxFollowing is the syntax −public static float Ceiling (float val);Above, Val is the floating-point value.ExampleLet us now see an example to implement the MathF.Ceiling() method −using System; class Demo {    public static void Main(){       float val1 = 12.67f;       float val2 = 30.13f;       Console.WriteLine("Ceiling (value1) = "+MathF.Ceiling(val1));       Console.WriteLine("Ceiling (value2) = "+MathF.Ceiling(val2));    } }OutputThis will produce the following output −Ceiling (value1) = 13 Ceiling (value2) = ... Read More

MathF.Cbrt() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:05:14

107 Views

The MathF.Cbrt() method in C# is used to return the cube root of a floating-point value.SyntaxFollowing is the syntax −public static float Cbrt (float val);ExampleLet us now see an example to implement the MathF.Cbrt() method −using System; class Demo {    public static void Main(){       float val1 = 64f;       Console.WriteLine("Cube root = "+MathF.Cbrt(val1));    } }OutputThis will produce the following output −Cube root = 4ExampleLet us now see another example to implement the MathF.Cbrt() method −using System; class Demo {    public static void Main(){       float val1 = 12.67f;     ... Read More

Char.IsNumber() Method in C#

AmitDiwan
Updated on 13-Nov-2019 07:04:02

388 Views

The Char.IsNumber() method in C# is used to indicate whether the specified Unicode character is categorized as a number.SyntaxFollowing is the syntax −public static bool IsNumber (char ch);Above, the parameter ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsNumber() method −using System; public class Demo {    public static void Main(){       bool res;       char val = '2';       Console.WriteLine("Value = "+val);       res = Char.IsNumber(val);       Console.WriteLine("Is the value a number? = "+res);    } }OutputThis will produce the following output ... Read More

MathF.Pow() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:02:54

252 Views

The MathF.Pow() method in C# is used to compute a number raise to the power of another number.SyntaxFollowing is the syntax −public static float Pow (float val1, float val2);Above, val1 is the floating-point number raised to a power. The val2 parameter is the power or exponent.ExampleLet us now see an example to implement the MathF.Pow() method −using System; public class Demo {    public static void Main(){       float val1 = 5.00f;       float val2 = 3.00f;       Console.WriteLine("MathF.Pow() = "+MathF.Pow(val1, val2));    } }OutputThis will produce the following output −MathF.Pow() = 125ExampleLet us ... Read More

Advertisements