Sudhir sharma has Published 1149 Articles

Sum of sum of first n natural numbers in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:18:27

267 Views

In this problem to find the sum of sum of first n natural numbers, we will find the sum of all numbers from 1 to n and add them together to find the sum.Let’s take an example to learn about the concept, Input : 4 Output : 10 Explanation : ... Read More

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

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:17:01

133 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

Binary Search in C++ program?

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:12:46

906 Views

binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which ... Read More

Sum of squares of Fibonacci numbers in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:08:17

231 Views

Fibonacci series is a mathematical sequence of number which starts from 0 and the sum of two numbers is equal to the next upcoming number, for example, the first number is 0 and the second number is 1 sum of 0 and 1 will be 1F0=0, F1=1AndFn=Fn-1+Fn-2, F2=F0+F1 F2=0+1 F2=1then ... Read More

Sum of squares of binomial coefficients in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:05:24

379 Views

The binomial coefficient is a quotation found in a binary theorem which can be arranged in a form of pascal triangle it is a combination of numbers which is equal to nCr where r is selected from a set of n items which shows the following formulanCr=n! / r!(n-r)! or ... Read More

Binary representation of a given number in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 11:02:52

3K+ Views

A binary number is a number that consists of only two digits 0 and 1. For example, 01010111.There are various ways to represent a given number in binary form.Recursive methodThis method is used to represent a number in its binary form using recursion.AlgorithmStep 1 : if number > 1. Follow ... Read More

Balance a string after removing extra brackets in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:56:41

184 Views

A string is an array of characters. In this problem, we are given a string which has opening and closing brackets. And we will balance this string by removing extra brackets from the string.Let’s take an example, Input : “)Tutor)ials(p(oin)t(...)” Output : “Tutorials(p(oin)t(...))”To solve this problem, we will traverse through ... Read More

Average of max K numbers in a stream in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:52:36

221 Views

The average of number in a stream means calculating the average after every insertion. But in this problem, we need to find the average of max K numbers in a stream i.e. only k numbers of the array are considered for calculating the average. When we add a number if ... Read More

Average of a stream of numbers in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:48:19

850 Views

Average of numbers is the sum of numbers divided by the total number of numbers.In this problem, we are given a stream of numbers. And we will print average of the number at every point.Let’s take an example of how it works −We have a stream of 5 number 24 ... Read More

Associative arrays in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:44:35

3K+ Views

In c++ programming language, an associative array is a special type of array in which the index value can be of any data type i.e. it can be char, float, string, etc. These associative arrays are also known as maps or dictionaries. Also, the indexes are given a different name ... Read More

Advertisements