Skip to main content
Engineering LibreTexts

4: Searching and Sorting Algorithm

  • Page ID
    46792
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Unit Objectives

    Upon completion of this unit you should be able to:

    • describe the process of searching and sorting
    • design algorithms for searching and sorting
    • implement algorithms for searching and sorting

    Unit Introduction

    In this unit, you will learn some common processes that arise in computing; these are searching and sorting. Some common processes are those that involve finding a particular item in a given list of items, called searching. Another involves ordering items in a particular way of some given data, called sorting. The two represent a common application in computers where data has to be searched and retrieved. An example of an everyday application of this is in a telephone directory. It stores information such as the names, addresses and phone numbers of its customers. As the amount of information to be stored and accessed becomes very large, the computer comes in handy to assist in this task. To access the stored data, searching and sorting are carried out.

    Key Terms
    • Searching: the algorithmic finding of a particular item in a collection of given items
    • Sorting: the ordering of items in a given list

    Learning Activities

    • 4.1: Activity 1 - Searching Algorithm
      This activity involves studying the searching process and how to write algorithms that can find a particular given item from a list of given items. The activity of searching will dedicate itself to providing the answer of a presence or no presence of the searched item. The section will dedicate itself to introducing the sequential and binary types of search.
    • 4.2: Activity 2 - Sorting Algorithm
      This activity involves studying the sorting process and how to write algorithms that can order particular items in a list to be in given order. The activity of sorting ensures items in a given list are arranged in a desired order, say ascending or descending. The section involves studying insertion sort, shell sort, and quicksort algorithms.
    • 4.3: Unit Summary
      This unit discussed the searching and sorting algorithms together with their examples. Searching which is about finding a particular item in a given list of items, and Sorting on the other hand which is the ordering in a particular way of some given data, were explained. For the searching, the sequential and binary searches were discussed. While for the sorting algorithm, insertion sort, shell sort and quicksort were discussed.


    This page titled 4: Searching and Sorting Algorithm is shared under a CC BY-SA license and was authored, remixed, and/or curated by Harrison Njoroge (African Virtual University) .

    • Was this article helpful?