Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Search Algorithms

In the world of computer science, a search algorithm is a technique which helps in solving the search problem. These types of algorithms work to recover info stored within some data structure. In simple words, we can say that search algorithms are created to inspect for an item or retrieve an item from any data structure where it is kept.

Search Algorithms

Table of Contents

These algorithms are divided into two groups based on the search operations and performance, and they are –

    1. Sequential Search:In this, each element of the list or array is examined as it is visited sequentially. Take linear search as an example.
  1. Interval Search: These types of techniques were created especially to search in sorted data structures. These algorithms usually are more effective than linear search because they divide the search space in half and repeatedly target the centre of the search structure. Take binary search as an example.

Popular Types of Search Algorithms are:

  • Linear Search
  • Binary Search
  • Jump Search
  • Interpolation Search
  • Exponential Search
  • Sublist Search (Search a linked list in another list)
  • Fibonacci Search
  • The Ubiquitous Binary Search

Practice Problems

Q1. Let A be an array of 31 numbers consisting of a sequence of 0’s followed by a sequence of 1’s. The problem is to find the smallest index i such that A[i] is 1 by probing the minimum number of locations in A. The worst case number of probes performed by an optimal algorithm is _________.

Q2. Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?

  • (A) O(1)
  • (B) O(log n)
  • (C) O(n)
  • (D) O(n log n)

Q3. Suppose we have a balanced binary search tree T holding n numbers. We are given two numbers L and H, and wish to sum up all the numbers in T that lie between L and H. Suppose there are m such numbers in T. If the tightest upper bound on time to compute the sum is 0(na logbn + mc logdn), the value of a + 10b + 100c + 1000d is ____.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility CriteriaGATE 2023GATE Admit CardGATE Syllabus for CSE (Computer Science Engineering)GATE CSE NotesGATE CSE Question Paper, and more.

Also Explore,