Sunidhi Bansal has Published 1100 Articles

Program to check bitnoicity of an array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:03:01

345 Views

Given an array arr[N] of N integers, the task is to check whether the given array is bitonic or not. If the given array is bitonic then print “Yes its a bitonic array”, else print “No its not a bitonic array”.A Bitonic array is when the array is in strictly ... Read More

Program for average of an array(Iterative and Recursive) in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:59:49

1K+ Views

Given an array of N integers arr[N], the task is to find the average of arr[N]. To achieve the result we can either use iterative approach or the recursive approach. We will be showing both in the given solution.Average of an array will be sum of all the elements of ... Read More

Program to add two binary strings in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:56:19

10K+ Views

Given two strings with binary number, we have to find the result obtained by adding those two binary strings and return the result as a binary string.Binary numbers are those numbers which are expressed either as 0 or 1. While adding 2 binary numbers there is binary addition rule which ... Read More

Product of all prime nodes in a Singly Linked List in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:54:05

207 Views

Given with n nodes and the task is to print the product of all the prime nodes in a linked list. Prime nodes are the ones that will have prime values as their count locations.Input 10 20 30 40 50Output 4, 00, 000Explanation − 10 is at index value 1 which is ... Read More

Product of all nodes in a Binary Tree in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:49:54

158 Views

Given with a binary tree containing nodes and the task is to find the product of all the nodes of a given binary tree.In a binary tree, there is a root node which is the master node of all the nodes in a tree. A node contains data part, left ... Read More

Product of all leaf nodes of binary tree in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:46:42

378 Views

Given with a binary tree containing nodes and the task is to find the product of all the leaf nodes of a given binary tree.Leaf nodes are the end nodes which don’t have any children. In a tree, a node can act as a parent node or child node except ... Read More

Product of nodes at k-th level in a tree represented as string in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:43:54

74 Views

Given with the tree of nodes with data in a string format and the task is to find the product of the nodes at k-th level in a binary tree. Every node of a tree contains three things i.e. data part, left pointer for left subtree and right pointer for ... Read More

Probability of A winning the match when individual probabilities of hitting the target given in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:40:54

64 Views

Given with two players let’s say A and B both are trying to get a penalty for winning the match. Given with four integer variables a, b, c, d so the probability of A getting the penalty first is a / b and probability of B getting the penalty first ... Read More

Probability of a key K present in array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:38:44

240 Views

Given with an array of size ’n’ and the task is to find the probability of the given element k if available in an array.Traverse the entire array till ‘n’ which is equals to the number of elements in an array and search for the given element or key ‘k’. ... Read More

Probability of a random pair being the maximum weighted pair in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 06:27:51

79 Views

Given with two different arrays and the task is to find the probability of the random pair chosen to be the maximum weighted pair.A Pair will contain one element from let’s say array1 and another element form another array let’s say array2. So the program must find the probability of ... Read More

Advertisements