Searching
NCERT Class 12 Computer Science Chapter 6: Searching (Pages 81–96)
Listen to this article
Summary of Searching
Searching at a Glance
CBSE
Class 12
Computer Science
Computer Science
6
81–96
6 study resources
Searching Summary
Searching in computer science is fundamentally about locating a specific element within a collection of data, such as arrays or lists. This chapter introduces key searching methods: linear search, binary search, and hashing, each with unique characteristics and use cases. The chapter begins with linear search, the simplest method where every element in the list is checked one by one until the desired item is found or the end of the list is reached. While straightforward, linear search is inefficient for large datasets as it compares every element sequentially. It works best for small or unsorted lists. Next, the focus shifts to binary search, a more efficient method that requires the list to be sorted beforehand. This method divides the list into halves, repeatedly narrowing down the search space based on the middle element's comparison with the key. If the middle element matches the search key, the search ends successfully. If the key is smaller, the search continues in the left half; if larger, in the right half. This technique significantly reduces search time, making it suitable for larger datasets, as it halves the search area with each comparison. The chapter also covers hashing, an even faster search technique where a hash function determines the index of elements in a list, allowing for direct access with a single comparison. However, collisions can occur if two elements generate the same index, and mechanisms for resolving these collisions are necessary for effective retrieval. Together, these searching techniques provide essential tools for efficient data handling and retrieval, each applicable in different scenarios depending on the data structure and size. Understanding these concepts is crucial for programming and algorithm design, equipping students with the knowledge needed for advanced studies in computer science.
