Sudhir sharma has Published 1149 Articles

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

sudhir sharma

sudhir sharma

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

259 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

273 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

680 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

749 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

Write a C program to print “ Tutorials Point ” without using a semicolon

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 11:29:03

267 Views

To print any string without using a semicolon we need to find how the standard output work and why is semicolon used.The semicolon is a end of line statement that is used to tell the program that the line is ended here. The standard print statement printf used here is ... Read More

Sum of first n natural numbers in C Program

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 11:08:28

1K+ Views

The concept of finding the sum of sum of integers is found such that first, we will find the sum of numbers up to n and then add all the sums to get a value which will be the sum of sum which is our desired sum.For this problem, we ... Read More

Program to calculate Bitonicity of an Array

sudhir sharma

sudhir sharma

Updated on 01-Jul-2020 06:07:18

116 Views

The bitonicity of an array is defined using the following syntax −To find bitonicity of an array based on its elements is −Bitonicity = 0 , initially arr[0] i from 0 to n Bitonicity = Bitonicity+1 ; if arr[i] > arr[i-1] Bitonicity = Bitonicity-1 ; if arr[i] < arr[i-1] Bitonicity ... Read More

Advanced master theorem for divide and conquer recurrences

sudhir sharma

sudhir sharma

Updated on 08-Jun-2020 05:44:13

2K+ Views

Divide and conquer is an algorithm that works on the paradigm based on recursively branching problem into multiple sub-problems of similar type that can be solved easily.ExampleLet’s take an example to learn more about the divide and conquer technique −function recursive(input x size n)    if(n < k)     ... Read More

XOR of all Prime numbers in an Array in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:57:01

265 Views

In this problem, we are given an array of n elements. Our task is to print xor of all prime numbers of the array.Let’s take an example to understand the problem, Input − {2, 6, 8, 9, 11}Output −To solve this problem, we will find all the prime numbers of ... Read More

Advertisements