Sudhir sharma has Published 1206 Articles

pow() function for complex number in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 06:58:09

549 Views

pow() or power function is a function used to calculate the power of a number. It is generally used in real numbers. Here, we will see its implementation of complex numbers.Complex numbers are those numbers that can be represented as A + iB, where A is the real part and ... Read More

Power in Mathematics in C++

sudhir sharma

sudhir sharma

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

100 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

137 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

647 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

584 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

144 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

846 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

501 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

303 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

Precision of floating point numbers in C++ (floor(), ceil(), trunc(), round() and setprecision())

sudhir sharma

sudhir sharma

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

7K+ Views

Precision of floating point numbers is the accuracy upto which a floating point number can hold the values after decimal.For example 10/6 = 1.6666666… these have recurring decimals which can take infinite memory spaces to be stored.So to avoid memory overflow in such cases the compiler set a precision limit ... Read More

Advertisements