Sunidhi Bansal has Published 1101 Articles

Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space using C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:16:33

655 Views

We are given a positive integer type array, let's say, arr[] of any given size such that elements in an array should value greater than 0 but less than the size of an array. The task is to rearrange an array in such a manner that arr[i] becomes arr[arr[i]] within ... Read More

C++ program to rearrange an array in maximum minimum form

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:11:54

1K+ Views

We are given an integer array which can be arranged in sorted/unsorted manner. The task is to first sort the array if the values are unsorted then arrange the array in such a manner that the first element of array will be the maximum value, second will be the minimum ... Read More

C++ program to rearrange all elements of array which are multiples of x in increasing order

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:07:45

289 Views

We are given an integer type array as ‘int arr[]’ and an integer type variable as ‘x’. The task is to rearrange all the elements of an array in such a manner that they will be divisible by a given integer value ‘x’ and the arrangement should be in an ... Read More

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

111 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

448 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

134 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

453 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

323 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

690 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

734 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

Previous 1 ... 6 7 8 9 10 ... 111 Next
Advertisements