Sunidhi Bansal has Published 1078 Articles

Print missing elements that lie in range 0 – 99

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

240 Views

It will display the missing values from the given set entered by the userGiven : array = {88, 105, 3, 2, 200, 0, 10}; Output : 1 4-9 11-87 89-99AlgorithmSTART STEP 1-> Take an array with elements, bool flag[MAX] to Fale, int i, j, n to size of array Step ... Read More

Print uncommon elements from two sorted arrays

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

2K+ Views

Given two sorted arrays and output should display their uncommon elementsGiven : array1[]= {1, 4, 6, 9, 12}    array2[]= {2, 4, 7, 8, 9, 10} Output : 1 2 6 7 8 10 12AlgorithmSTART Step 1 -> declare two arrays array1 and array2 with elements as int and variables ... Read More

Print first N terms of series (0.25, 0.5, 0.75, …) in fraction representation

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

227 Views

Input N which is equivalent to the number till where series should be printedInput : N=5 Output : 0 ¼ ½ ¾ 1AlgorithmSTART Step 1 -> declare start variables as int num , den, i, n Step 2 -> input number in n Step 3 -> Loop For from i ... Read More

Print numbers in descending order along with their frequencies

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

532 Views

Given with an array of int elements, the task is to arrange the elements in descending order and finding their occurrences.Input : arr[]={1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 7} Output : 7 occurs: 2    6 occurs: 1    5 occurs: 1    4 ... Read More

Print matrix in antispiral form

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

449 Views

Given a 2d array of n*n and the task is to find the antispiral arrangement of the given matrixInput : arr[4][4]={1, 2, 3, 4,    5, 6, 7, 8,    9, 10, 11, 12    13, 14, 15, 16} Output: 10 11 7 6 5 9 13 14 15 16 ... Read More

Print matrix in diagonal pattern

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

486 Views

Given a 2d array of n*n and the task is to find the antispiral arrangement of the given matrixInput : arr[4][4]={1, 2, 3, 4,    5, 6, 7, 8,    9, 10, 11, 12    13, 14, 15, 16} Output : 1 6 11 16 4 7 10 13AlgorithmSTART Step ... Read More

Print an array with numbers having 1, 2 and 3 as a digit in ascending order

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

749 Views

Here, the task is to print those number in an array having 1, 2 and 3 as digits in their numbers and if their is no such number than the output must be -1Input : arr[] = {320, 123, 124, 125, 14532, 126, 340, 123400, 100032, 13, 32, 3123, 1100} ... Read More

Print prime numbers with prime sum of digits in an array

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

660 Views

Given with an array of elements and the task is to print those numbers whose digit sum is also prime and return -1 is not such digit exists in an arrayInput: arr[]={2, 4, 3, 19, 25, 6, 11, 12, 18, 7} Output : 2, 3, 25, 11, 12, 7Here, the ... Read More

Print numbers having first and last bits as the only set bits

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

263 Views

The task is to print the given n number which have exactly two set bits that neither less than 2 nor more than 2.Set bits in computer language are the one that have value 1 and unset bits have value as 0Input: value of num=5 Output: 1 3 5   ... Read More

Print Postorder traversal from given Inorder and Preorder traversals

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

1K+ Views

Given with inorder and preorder of a tree program must find the postroder traversal and print the sameInput: Inorder traversal in[] = {4, 2, 5, 1, 3, 6} Preorder traversal pre[] = {1, 2, 4, 5, 3, 6} Output: Postorder traversal post[] = {4, 5, 2, 6, 3, 1}AlgorithmSTART Step ... Read More

Advertisements