Category: data structure

Merge Two Sorted Arrays

“Merge Two Sorted Arrays” is an important problem of array data structure. Here, we are given two sorted arrays of size ‘n’ and ‘m’ respectively. Our task is to write a program to merge these two sorted arrays and the resultant array must itself be sorted array. Example (Merge Two...

First Repeating Element in an Array

“First Repeating Element in an Array” is an important and one of the favourite technical interview problems based on array data structure. Here, we are given an array of ‘n’ elements and our task is to find the first repeating element in an array.  If all the elements of the...

Pair in an Array with Given Sum

“Pair in an Array with Given Sum” is one of the favorite technical interview problems. Here, we are given an array with ‘n’ elements and a target value ‘x’. Our task is to find a pair in an array, whose sum is equal to target value ‘x’. Example (Pair in...

blank

Find Most Frequent Element in an Array

“Find Most Frequent Element in an Array” is one of the favourite technical interview problem based on array data structutre. Here, we are given an array of ‘n’ elements and Our task is to find the most frequent element in an array. If there are multiple elements with same highest...

blank

Rotate Array Elements by D Positions

“Rotate Array Elements by ‘D’ Positions” is one of the most favorite technical interview problem based on array data structure. Here, we are given an array with ‘n’ elements and a ‘d’ value. Our task is to write a program to rotate the given array by ‘d’ positions in clock...

blank

Linear Search

Linear Search is the simplest and easiest searching algorithm. Linear search algorithm works by simply finding the desired element from start to end of the list.  Linear search algorithm returns the index position of the element, if found in the list, else, returns false or invalid index position (i.e., -1)....

blank

Count All Occurrences of an Element in an Array

“Count All Occurrences of an Element in an Array” is a basic problem of array data structure. Here, we are given an array of size ‘n’ and an element ‘x’. Our task is to write a program to count all occurrences of an element in an array. Example (Count All...

blank

Find Smallest and Largest Element in an Array

“Find Smallest and Largest Element in an Array” is an elementary problem of an Array data structure for beginners. Here, we are given an array of size ‘n’ and our task is to find the largest and smallest element of the array. Example (Find smallest and Largest Element in an...

blank

Count Even and Odd numbers in an Array

“Count Even and Odd numbers in an Array” is an elementary problem of array data structure for beginners. Here, we are given an array of size ‘n’ and our task is to count the number of even elements and number of odd elements of an array. Example: INPUT: Enter the...