Sudhir sharma has Published 1206 Articles

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

sudhir sharma

sudhir sharma

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

85 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 ... Read More

C++ Balanced expression with replacement

sudhir sharma

sudhir sharma

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

279 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 ... Read More

Absolute distinct count in a sorted array in C++?

sudhir sharma

sudhir sharma

Updated on 06-Jul-2020 08:24:37

209 Views

An array is a collection of elements of the same data type. A sorted array is an array that has elements stored in a sequence of ascending or descending order.The distinct count is the number of elements that are not the same.Absolute distinct count is distinct count of absolute value ... Read More

How to convert hex string to byte Array in Java?

sudhir sharma

sudhir sharma

Updated on 03-Jul-2020 08:12:11

5K+ Views

We can convert a hex string to byte array in Java by first converting the hexadecimal number to integer value using the parseInt() method of the Integer class in java. This will return an integer value which will be the decimal conversion of hexadecimal value. We will then use the ... Read More

A Number Link Game?

sudhir sharma

sudhir sharma

Updated on 02-Jul-2020 05:37:51

536 Views

Number link is a type of logic puzzle involving finding paths to connect numbers in a grid.A simple example of a Numberlink puzzle The solution to the Numberlink puzzleRules − The player has to pair up all the matching numbers on the grid with single continuous lines (or paths). The ... Read More

Add all greater values to every node in a given BST?

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 14:57:28

190 Views

A BST or binary search tree is a form of binary tree that has all left nodes smaller and all right nodes greater than the root value. For this problem, we will take a binary tree and add all the values greater than the current node to it. the problem ... Read More

Average numbers in array in C Programming

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 12:08:59

197 Views

There are n number of elements stored in an array and this program calculates the average of those numbers. Using different methods.Input - 1 2 3 4 5 6 7Output - 4Explanation - Sum of elements of array 1+2+3+4+5+6+7=28No of element in array=7Average=28/7=4There are two methodsMethod 1 −IterativeIn this method we will find ... Read More

C program to find the length of a string?

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 11:38:51

517 Views

The string is actually a one-dimensional array of characters which is terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise the string followed by a null.To find the length of a string we need to loop and count all words in the loop until the ... Read More

C Program to Multiply two Floating Point Numbers?

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 11:36:53

514 Views

Float is a shortened term for "floating-point." By definition, it's a fundamental data type built into the compiler that's used to define numeric values with floating decimal points. A floating-point type variable is a variable that can hold a real number, such as 4320.0, -3.33, or 0.01226. The floating part ... Read More

C Program for Tower of Hanoi

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 11:35:25

13K+ Views

The tower of Hanoi is a mathematical puzzle. It consists of three rods and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top. ... Read More

Advertisements