# 11.6 Searching and Sorting¶

- Searching data involves determining whether a value (referred to as the search key) is present in the data and, if so, finding its location
  - Two popular search algorithms are the simple linear search and the faster but more complex binary search
- Sorting places data in ascending or descending order, based on one or more sort keys
- We selection sort and insertion sort, along with the more efficient but more complex merge sort

Chapter | Algorithm | Location
--- | --- | ---
Searching Algorithms, Functions and Methods |
5 | List method index | Section 5.9
8 | String methods count, index and rindex. | Section 8.7
8 | re module functions search, match, findall and finditer | Section 8.12
15 | Linear search | Section 11.7
15 | Binary search | Section 11.9
15 | Recursive binary search | Exercise 11.18
Sorting Algorithms, Functions and Methods |
5 | List method sort | Section 5.8
5 | Built-in function sorted | Section 5.8
5 | Built-in function sorted with a key | Exercise 5.15
7 | DataFrame methods sort_index and sort_values | Section 7.14
11 | Selection sort | Section 11.11
11 | Insertion sort | Section 11.12
11 | Recursive merge sort | Section 11.13
11 | Bucket sort | Exercise 11.17
11 | Recursive quicksort | Exercise 11.19

©1992–2020 by Pearson Education, Inc. All Rights Reserved. This content is based on Chapter 5 of the book Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and the Cloud.

DISCLAIMER: The authors and publisher of this book have used their best efforts in preparing the book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The authors and publisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation contained in these books. The authors and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs.