0% found this document useful (0 votes)
7 views4 pages

Searching and Sorting

Computer class 10

Uploaded by

veerthedarkruler
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Searching and Sorting

Computer class 10

Uploaded by

veerthedarkruler
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SEARCHING AND SORTING

SEARCHING: - Searching is the process of finding out the location of a


particular element. It is said to be successful if element is found in the
list otherwise said to be unsuccessful.

Types of searching

1. Internal Searching 2. External Searching

list is available in main memory list is available on hard disk

1. linear/sequential search 1. Linear Search

2. Binary search 2. Binary Search

Linear Search Binary Search


1. It checks for each element in 1. In this process, searched
the list one by one till the element will compare with
element is not found. the middle element and then
moves in left or right
direction by skipping most of
elements during searching
process.

2. List may or may not be 2. List must be in sorted order.


sorted.
3. Searching process becomes 3. It is 7 times faster than linear
slow when records are many. search.

4. It is suitable for small 4. Suitable for big organization


organization when records when records are many.
are less.

Applications:-
Linear Search can be used for searching in a small and unsorted set of
data which is guaranteed not to increase in size by much. It is a very
basic search algorithm but due to its linear increase in time complexity,
it does not find application in many production systems.

SORTING: - The process of arranging data elements in the array which


are randomly placed in either ascending order or descending order is
called sorting of the array.

Types of Sorting

1. Internal Sorting 2.External Sorting

list is available in main memory list is available on hard disk

1. Bubble Sort 1.Bubble Sort


2.Selection Sort 2.Selection Sort
3.Quick Sort 3.Quick Sort
4.Heap Sort 4.Heap Sort
5.Merge Sort 5.Merge Sort
6.Insertion Sort 6.Insertion Sort
7.Radix Sort 7.Radix Sort

Bubble Sort: - Bubble sort, sometimes referred to as sinking sort, is a


simple sorting algorithm that repeatedly steps through the list to be
sorted, compares each pair of adjacent items and swaps them if they
are in the wrong order. The pass through the list is repeated until no
swaps are needed, which indicates that the list is sorted. The algorithm,
which is a comparison sort, is named for the way smaller elements
"bubble" to the top of the list. Although the algorithm is simple, it is too
slow and impractical for most problems even when compared to
insertion sort. It can be practical if the input is usually in sort order but
may occasionally have some out-of-order elements nearly in position.
Limitation: - It goes through all the loop cycles even if the data
elements are sorted much before.

You might also like