Sudhir sharma has Published 1149 Articles

Power in Mathematics in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 06:55:32

167 Views

The power of a number is the times a number is multiplied to itself. Also knows as exponent or indices.a to the power b is b times a is multiplied by itself b times. 7 to the power 2 is 72 also known as 7 square is valued 49.Some common ... Read More

Power of a prime number r in n! in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 06:49:39

221 Views

In this problem, we are given two integer n and r. Our task is to find the power of the given prime number r in the factorial of the number n.Let’s take an example to understand the problemInput − n = 6 r = 2Output − 4Explanation −Factorial n, 6! ... Read More

Power Set in Lexicographic order in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 06:46:51

758 Views

In this problem, we are given string str. Our task is to print the power set of this string’s elements in lexicographical order.Power Set − The power set of a set is the set of all subsets of the set. Denoted by P(S) where s is the set.Example −S = ... Read More

Powers of 2 to required sum in C++

sudhir sharma

sudhir sharma

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

674 Views

In this problem, we are given an integer N. Our task is to print the number which when raised to the power of 2 gives the number.Let’s take an example to understand the problemInput − 17Output − 0, 4Explanation − 17 = 24 + 20 = 16 + 1To solve ... Read More

Powers of two and subsequences in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 06:41:39

207 Views

In this problem, we are given an array of N integers. Our task is to find the count of subsequences that can be formed such that if their elements are multiplied, they result in a number which is a power of two.Let’s take an example to understand the problem, Input ... Read More

Practice questions on Arrays in C++

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:48:37

1K+ Views

Array is a data structure that store data in the contagious memory location.Declaring arraysDeclaring arrays is done by the following syntax : int 1D[] - for 1-D array int 2D[][] - for 2-D arrayIf you initialize an array with lesser number of elements, rest are initialized with 0.Memory address of ... Read More

Practice questions on Strings in C++

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:46:23

680 Views

String is an important part of programming. Strings are the array of character types. In competitive exams like GATE also it is an important topic. So let’s discuss some key points about string and then we will proceed to some questions that will help you clear your concepts about string.String ... Read More

Practice Set for Recurrence Relations

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:41:10

426 Views

Recurrence relations are equations that recursively defines a multidimensional array.Here we will solve so questions based on recurrence relations.Solve the recurrence reation:T(n) = 12T(n/2) + 9n2 + 2. T(n) = 12T(n/2) + 9n2 + 2. Here, a = 12 and b = 2 and f(n) = 9(n)2 + 2 It ... Read More

Predefined Identifier __func__ in C

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:30:13

2K+ Views

Identifier is the name given to an entity in programming to identify it in the program.Generally, identifiers are created by the programmer for efficient working but there are some predefined identifiers that are inbuilt in programming. For example, cout, cin, etc.Here, we will see one of these predefined identifiers of ... Read More

Predict the winner in Coin Game in C++

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:23:59

339 Views

In this game, there are two players X and Y. our task is to predict who will win the game if both play optimally and X starts the game.GameIn the coin game, there are two piles with N and M number of coins. One of the players chooses any one ... Read More

Advertisements