Sort, Search, Overload, Template, Recursive
Sort, Search, Overload, Template, Recursive
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.
Function Overloading
- two functions can have same name if
number and/or type of arguments passed are
different.
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