Sunidhi Bansal has Published 1085 Articles

Recursive sum of digit in n^x, where n and x are very large in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:04:24

180 Views

We are given positive integer variables as ‘num’ and ‘x’. The task is to recursively calculate the num ^ x then add the digits of a resultant number till the single digit isn’t achieved and the resultant single digit will be the output.Let us see various input output scenarios for ... Read More

Recursive program to print all numbers less than N which consist of digits 1 or 3 only in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 05:53:00

574 Views

We are given an integer variable as N storing the positive integer type value. The task is to recursively print all the numbers less than given value N having digit 1, 3 or the combination of both.Let us see various input output scenarios for this −Input − int num = 40Output − ... Read More

Rearrange array such that arr[i] >= arr[j] if i is even and arr[i]<=arr[j] if i is odd and j < i in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 05:42:33

228 Views

We are given an integer array containing odd and even integer values. The task is to rearrange an array in such a manner that arr[i] should be greater than or equals to arr[j] based on the condition that value at index arr[i] should be even and if value at arr[i] ... Read More

Merge a linked list into another linked list at alternate positions in Java

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 10:00:39

887 Views

We are given two data structures as linked list Let’s say, List_1 and List_2. The task is to merge the elements of linked list ‘List_2’ into the linked list ‘List_1’ at an alternate position and if we are left with the elements which can't be merged into ‘List_1’ then it ... Read More

Memory representation of Binomial Heap in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 09:43:54

507 Views

What is a Binomial Tree?Binomial tree is an ordered tree data structure, let's say, B0 consists of a single node whereas a binomial tree represented as Bk consists of two binomial trees i.e. Bk-1 which are linked together. The root of one binomial tree is the leftmost child of the ... Read More

Min-Max Range Queries in Array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 09:42:24

987 Views

Given an array Arr[] containing N elements. The goal is to find the minimum and maximum value from indexes of query.According to the query we are given starting index and ending indexes.For ExampleIn − Arr[] = { 1, 2, 3, 4, 5 } QStart = 1 QEnd = 4Out −Minimum Value : ... Read More

New feature of C++17

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 09:07:35

1K+ Views

The C++ Standards committee is always focusing on shipping new features every three years. The two main parts of the specification are the core functionality of the programming language and the Standard Template Library (STL). The new features are introduced to make the code cleaner, easier and compact. Following is ... Read More

2-3 Trees - Data Structures and Algorithms in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 08:56:52

8K+ Views

A 2-3 Tree is a type of tree in data structures in which every node of the tree is either a 2 nodeor 3 nodes. It is a special type of B-Tree with order 3.A 2 node in the tree is one which has one data part and two child ... Read More

Maximize the number of subarrays with XOR as zero in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 08:54:16

218 Views

We are given an array Arr[] containing integer values. The goal is to find the maximum number of subarrays with XOR as 0. The bits of any subarray can be swapped any number of times.Note:- 1

Maximize the summation of numbers in a maximum of K moves in range [L, R] in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Oct-2021 08:45:52

141 Views

We are given an array Arr[] containing integers and 2D array Q containing queries. Each query contains 3 values that are lpos, rpos and K. One can move from index i to next index i+1 in a single step or remain in that index. One can move from lpos to ... Read More

Advertisements