VOOZH about

URL: https://www.geeksforgeeks.org/dsa/searching-elements-in-an-array-array-operations/

⇱ Searching Elements in an Array | Array Operations - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Searching Elements in an Array | Array Operations

Last Updated : 23 Jul, 2025

In this post, we will look into search operation in an Array, i.e., how to search an element in an Array, such as:

  1. Searching in an Unsorted Array using Linear Search
  2. Searching in a Sorted Array using Linear Search
  3. Searching in a Sorted Array using Binary Search
  4. Searching in an Sorted Array using Fibonacci Search

Searching operations in an Unsorted Array using Linear Search

In an unsorted array, the search operation can be performed by linear traversal from the first element to the last element, i.e. Linear Search

👁 Image

Coding implementation of the search operation:


Output
Element Found at Position: 5

Time Complexity: O(N) 
Auxiliary Space: O(1)

Searching in a Sorted Array using Linear Search

In a sorted array, the most trivial method for search operation is by using Linear Search.

👁 Search Operation in a sorted array

Below is the implementation of the above approach:


Output
Element Found at Position: 6

Time Complexity: O(N) 
Auxiliary Space: O(1)

Searching in a Sorted Array using Binary Search

In a sorted array, the search operation can be performed efficiently by using binary search.

👁 Search Operation in a sorted array

Below is the implementation of the above approach:


Output
Index: 5

Time Complexity: O(log(n)) Using Binary Search
Auxiliary Space: O(log(n)) due to recursive calls, otherwise iterative version uses Auxiliary Space of O(1).

Searching in a Sorted Array using Fibonacci Search

Fibonacci Search is a comparison-based technique that uses Fibonacci numbers to search an element in a sorted array.

👁 Untitled

Below is the implementation of the above approach:


Output
Found at index: 11

Time Complexity: O(log(n)) Using Fibonacci Search
Auxiliary Space: O(1) Using Fibonacci Search

Comment
Article Tags:
Article Tags: