Posts

Showing posts from February, 2026

Unit - V -Data Structure - Searching, Sorting & Hashing

Image
  UNIT- V -  Data Structure Searching Searching in a data structure is the process of finding  a specific element within a collection of items . The two primary methods are  linear search  (for unsorted data) and  binary search  (for sorted data).   1. Linear Search Linear search, also known as sequential search, checks each element in a data structure one by one, from start to finish, until the target is found. It is simple to implement and works on both sorted and unsorted lists, but is inefficient for large datasets due to a time complexity of O(n).    How it works: 1.       Start the program. 2.       Read the number of elements and store them in a list. 3.       Read the element to be searched. 4.       Compare the search element with each element of the list one by one. 5.       If a match...