Table of Contents

    Introduction to Searching

    Searching is the process of finding a specific element in a collection of data.
    In Java, arrays are one of the most commonly used data structures, and very often we need to search an element inside an array.

    Why Searching Is Needed?

    • To find a student’s roll number

    • To check if a value exists in a list

    • To retrieve data quickly

    • To validate user input

    Example

    If an array contains marks:
    {45, 67, 89, 23, 90}
    Searching means checking whether a value like 89 is present or not.

    Searching is a basic operation and forms the foundation of many advanced algorithms.


    Types of Searching Techniques

    Searching techniques are methods used to locate an element in an array.

    Main Types of Searching:

    1. Linear Search

    2. Binary Search

    Classification Based on Data:

    Array Type Searching Method
    Unsorted Array Linear Search
    Sorted Array Binary Search

    Each technique has its own rules, speed, and use cases.