Searching and Sorting
Searching is the process of finding out the position of an element in a list. This chapter discusses two types of searching, namely linear search and binary search. In bubble sort to arrange elements in ascending order, begin with the 0th element, and is compared with the 1st element. The selection...
Saved in:
Published in | Data Structure and Algorithms Using C++ pp. 349 - 389 |
---|---|
Main Authors | , |
Format | Book Chapter |
Language | English |
Published |
United States
John Wiley & Sons, Incorporated
2021
John Wiley & Sons, Inc |
Subjects | |
Online Access | Get full text |
Cover
Loading…
Summary: | Searching is the process of finding out the position of an element in a list. This chapter discusses two types of searching, namely linear search and binary search. In bubble sort to arrange elements in ascending order, begin with the 0th element, and is compared with the 1st element. The selection sort starts from 1st element and searches the entire list until it finds the minimum value. In insertion sort, the first iteration starts with the comparison of 1st element with the 0th element. In the second iteration 2nd element is compared with the 0th element and 1st element. Merging means combining two sorted lists into one sorted list. For this the elements from both the sorted lists are compared. Quick sort uses the concepts of divide and conquer method. It is also known as partition exchange sort. |
---|---|
ISBN: | 9781119750543 1119750547 |
DOI: | 10.1002/9781119752059.ch10 |