Category: data structure

Sort an Array of 0s and 1s

“Sort an Array of 0s and 1s” is one of the favorite technical interview problem of array data structure. Here, we are given an array of size ‘n’ and our task is to sort this array.  Array contains only 0s and 1s. Example: INPUT: Arr[5] = {1, 0, 1, 0,...

Find mean of an Array

“Find mean of an Array” is a basic problem of array data structure. Here, we are given an array of size ‘n’ and our task is to find and print the mean of the array. Mean of an array = (sum of all the elements of the array) / n....

Find Majority Element of an Array

“Find Majority Element of an Array” is one of the most favorite technical interview problem based on array data structure. Here, we are given an array of size ‘n’ and our task is to find the majority element of the array.  If there is no majority Element, print a message...

blank

Find Equilibrium Index of an Array

“Find Equilibrium Index of an Array” is one of the favourite technical interview problem based on array data structure. Here, we are given an array of size ‘n’ and our task is to find equilibrium index of an array. Equilibrium index of an array is that index of array where...

blank

Print all Subarray of Given Array

“Print all Subarray of Given Array” is an important problem to understand the concept of subarrays of arrays. Here, we are given an array of size ‘n’ and our task is to print all subarray of the given array. Example (Print all Subarray of Given Array): INPUT: Arr[4] = {11,...

blank

Print Alternate Elements of an Array

“Print Alternate Elements of an Array” is elementary problem of array data structure. Here, we are given an array of size ‘n’ and our task is to print alternate elements of an array. Alternate elements defines, we are not supposed to print two subsequent elements. Example (Print Alternate Elements of...

blank

Check if Array is Sorted or Not

“Check if Array is Sorted or Not” is a basic problem of array data structure. Here, we are given an array of size ‘n’ and our task is to check if array is sorted or not. Example: INPUT: Arr[9] = {11, 22, 33, 44, 55, 66, 77, 88, 99} OUTPUT:...

blank

Find missing smallest positive number

“Find missing smallest positive number” is again one of the favourite technical interview problem. Here, we are given an unsorted array of size ‘n’ and our task is to find the missing smallest positive number from the array. The array may contain both positive and negative integers. Example (Find missing...