Sudhir sharma has Published 1206 Articles

Sum of subset differences in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:18:41

169 Views

In this problem, we are given a set S of n number. Our task is to create a program to find the sum of subset difference which is the difference of last and first elements of subset.The formula is, sumSubsetDifference = Σ [last(s) - first(s)] s are subsets of the ... Read More

Sum of similarities of string with all of its suffixes in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:17:23

160 Views

In this problem, we are given string str. Our task is to create a program to find the sum of similarities of the string with all of its suffixes.Suffixes of string str are all the strings that are created by eliminating starting characters of the string.Similarities of string str1 and ... Read More

Sum of series 1^2 + 3^2 + 5^2 + . . . + (2*n - 1)^2 in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:15:45

373 Views

In this problem, we are given a number n of the series. Our task is to find the sum of series 1^2 + 3^2 + 5^2 +... + (2*n - 1)^2 for the given value of n.Let’s take an example to understand the problem, Input −n = 5Output −84Explanation −sum ... Read More

Sum of special triplets having elements from 3 arrays in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:13:15

110 Views

In this problem, we are given 3 array X, Y, Z. Our task is to create a program to find the Sum of special triplets having elements from 3 arrays.Special Triplet is a special type of triplet that hold the following property −For (a, b, c): a ≤ b and ... Read More

Sum of smaller elements of nodes in a linked list in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:09:34

72 Views

In this problem, we are given a linked list with a node consisting of two values and a pointer. Our task is to create a program to find the sum of smaller elements of a node in a linked list.Here, in the linked list we have two elements say X ... Read More

Block swap algorithm for array rotation in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:08:00

1K+ Views

The block swap algorithm for array rotation is an efficient algorithm that is used for array rotation. It can do your work in O(n) time complexity.So, in array rotation, we are given an array arr[] of size n and a number k that define the no. of the element to ... Read More

BK Tree Introduction in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:05:17

226 Views

BK tree or Burkhard tree is a form of a data structure usually used to perform spell checks based on Levenshtein distance. It is also used for string matching Autocorrect feature can be used making this data structure. Let's say we have some words in a dictionary and we need ... Read More

Bitwise Sieve in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:02:03

589 Views

In this problem, we are given a number N. Our task is to find all prime numbers smaller than N using Bitwise Sieve.Bitwise sieve is an optimized version of Sieve of Eratosthenes which is used to find all prime numbers smaller than the given number.Let’s take an example to understand ... Read More

Bitwise recursive addition of two integers in C

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 08:00:49

3K+ Views

In this problem, we are given two numbers. Our task is to create a C program for the Bitwise recursive addition of two integers.The logic to find the sum using the Bitwise operations is similar to what we used to do when we were in preschool. For finding the sum, ... Read More

Bitwise OR of N binary strings in C++

sudhir sharma

sudhir sharma

Updated on 05-Aug-2020 07:59:26

269 Views

In this problem, we are given an array bin[] of size n of binary strings. Our task is to create a program to find the Bitwise OR (&) of n binary strings.Here, we will take all numbers and find the bitwise AND of them i.e. bin[0] | bin[1] |... bin[n-2] ... Read More

Advertisements