Find two elements in an array whose sum is x
Given an array of integers and a number x. check if there exists two elements in the array whose sum = x.
Linear Search – Video
This video discusses the Linear Search algorithm in detail.
Binary Search – Video
This video describes Binary search algorithm.
Binary Search or Half-interval search
Binary search is a Divide & Conquer algorithm used to search for an element in the array. It requires the array to be sorted. If array is not sorted then the only way to search in the array is Linear search. Binary search divide the number of elements to be searched in two halves in […]
Linear Search in detail
Linear search or Sequential search is a method for finding a particular value in a linear list of values (Array or Linked List). It is done by checking each of its elements, one at a time in list, until the desired one is found or the list is exhausted. Problem definition (for array) Given an Array […]
Search in a matrix sorted on rows & columns
Given a matrix whose each row and column is sorted as shown below 10 20 30 40 15 25 35 45 27 29 37 48 32 33 39 50 Write an algorithm that will search for the matrix for a value (say 37) and print the index of position where it finds the value. If […]