Summary

Section 16.1 Introduction

  • Searching data involves determining whether a search key is present in the data and, if so, finding its location.

  • Sorting involves arranging data into order.

Section 16.2 Searching Algorithms

  • The linear search algorithm searches each element in the array sequentially until it finds the correct element. If the element is not in the array, the algorithm tests each element in the array, and when the end of the array is reached, informs the user that the element is not present. If the element is in the array, linear search tests each item until it finds the correct item.

  • A major difference among searching algorithms is the amount of effort they require in order to return a result.

  • One way to describe the efficiency ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.