0% found this document useful (0 votes)
18 views2 pages

Sort, Search, Overload, Template, Recursive

The document outlines two searching techniques: Sequential Search (linear search) and Binary Search, highlighting their differences, such as the need for sorting in Binary Search. It also describes three array sorting algorithms: Bubble Sort, Selection Sort, and Insertion Sort. Additionally, it covers function overloading, function templates, and recursive functions, emphasizing their characteristics and uses.

Uploaded by

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

Sort, Search, Overload, Template, Recursive

The document outlines two searching techniques: Sequential Search (linear search) and Binary Search, highlighting their differences, such as the need for sorting in Binary Search. It also describes three array sorting algorithms: Bubble Sort, Selection Sort, and Insertion Sort. Additionally, it covers function overloading, function templates, and recursive functions, emphasizing their characteristics and uses.

Uploaded by

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

Two Types of Searching Techniques Array Sort

1. Sequential Search – aka linear search, 1. Bubble Sort - is the simplest sorting
starts the loop from the zero index of an algorithm, works by repeatedly swapping
array to the last index of an array. the adjacent elements if they are in wrong
order.
2. Selection Sort - repeatedly finding the
minimum element from unsorted part and
putting it at the beginning.
3. Insertion Sort - works the way we sort
playing cards on our hands.

2. Binary Search - can only be applied on a


sorted array, find the middle element of the
array and compare with the value the user
wanted to search.

Function Overloading
- two functions can have same name if
number and/or type of arguments passed are
different.

Differences Between Linear and Binary

Linear Binary
- doesn’t need to be - data needs to be
sorted sorted
- does the sequential - access data randomly
access - performs ordering
- performs equality comparisons
comparison
Function Template
- can create a single function or a class to
work with different data types

Recursive Function
- calls itself, aka recursion
- makes our code shorter and cleaner
- uses more processor time.
Ex. 1

Ex. 2

You might also like