Week 2 Flashcards

1
Q

Types of sorting algorithms

A

*Selection Sort
*Bubble Sort
*Insertion Sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Selection Sort

A

*Works by sorting the list one item at a time
*List divided into two parts: Sorted part and Unsorted part
*Initially, sorted part is empty and unsorted part is the entire list
*The smallest element is selected from the unsorted array and swapped with leftmost element, and the element becomes a part of the sorted array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Bubble Sort

A

*Works by repeatedly passing through the list to be sorted and swapping adjacent items if they are in the wrong order
*If sorting into ascending order the largest item will bubble to the top

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Insertion Sort

A

*Sort a list one item at a time
*The list split into a sorted part and non-sorted part
*With each iteration, it takes the next element waiting to be sorted and inserts it into the sorted part, into its proper location within the sorted items

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Efficiency of Sorting Algorithms

A

*Sequential sorts
*Logarithmic sorts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Types of Searching Algorithms

A

*Sequential Search
*Binary Search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Sequential Search

A

*Can be used on a list of objects stored in any order
*Method: Start the search at the beginning of the list -> check every element of the list in turn until either the target is located or you reached the end of the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Binary Search

A

*Can be used on a list of objects stored in a SORTED order
*Method: Starts by examining the element in the MIDDLE of the list(The search continues if the target element found at the middle element) -> the process repeated on this half of the list by examining the middle element and then eliminating the list -> either target element found or not in the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Recursion

A

A technique whereby a problem is expressed in a similar form to the original problem but smaller in scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Areas where Recursion can be used

A

*Stopping case (The solution is easy to specify for certain conditions)
*Recursive steps (There are well defined rules for proceeding to a new state which is either a stopping case or eventually leads to a stopping case)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly