Sudhir sharma has Published 1149 Articles

Print all paths from a given source to a destination using BFS in C++

sudhir sharma

sudhir sharma

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

1K+ Views

In this problem we are given a directed graph and we have to print all paths from the source to the destination of the graph using Breadth first Search (BFS).Directed graph is a graph in with edges that are directed from vertex a to b.Let’s take an example to understand the ... Read More

Print all permutation of a string using ArrayList in Java

sudhir sharma

sudhir sharma

Updated on 14-Jul-2020 07:27:07

759 Views

In this problem, we are given a string of size n and we have to print all permutations of the string. But this time we have to print this permutation using ArrayList.Let’s take an example to understand the problem -Input − string = ‘XYZ’Output − XYZ, XZY, YXZ, YZX, ZXY, ... Read More

Print all permutations with repetition of characters in C++

sudhir sharma

sudhir sharma

Updated on 14-Jul-2020 07:25:19

1K+ Views

In this problem, we are given a string of n characters and we have to print all permutations of characters of the string. Repeating of characters of the string is allowed. The printing of permutation should be done in alphabetical order (lexicographically sorted order).Let’s take an example to understand the ... Read More

Binary to Gray code using recursion in C program

sudhir sharma

sudhir sharma

Updated on 09-Jul-2020 11:49:04

2K+ Views

A Binary number is a number that has only two bits 0 and 1.Gray code is a special type of binary number that has a property that two successive number of the code cannot differ more than one bit. This property of gray code makes it useful more K-maps, error ... Read More

Binary representation of previous number in C++

sudhir sharma

sudhir sharma

Updated on 09-Jul-2020 11:40:57

302 Views

In this problem, we are given the binary representation of a number and we have to find the binary representation of the previous number i.e. the number that is resulted after subtracting one from the given number.Binary representation of a number is changing the base of the number to base ... Read More

Bakhshali Approximation for computing square roots in C program

sudhir sharma

sudhir sharma

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

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

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

180 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

401 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

How to convert hex string to byte Array in Java?

sudhir sharma

sudhir sharma

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

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

748 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

Advertisements