Week 4 Chapter 6 Flashcards
Q: Who is the mathematician after whom the term “algorithm” is derived?
A: The term “algorithm” is derived from Mohammed ibn-Musa al-Khwarizmi, a Persian mathematician who lived between 780 and 850 in Baghdad.
Q: What is another name for algorithms?
A: Algorithms are also known as pseudo-codes.
Q: What makes algorithms language independent?
A: Algorithms are language independent because they can be implemented in any programming language.
Q: What are the key characteristics of algorithms?
A: The key characteristics of algorithms are:
Language independent
Unambiguous
A set of predefined instructions
Focus on speed and efficiency
Initial step before software development.
Q: What is the main purpose of search algorithms?
A: The main purpose of search algorithms is to search in arrays for an item.
Q: Name two search algorithms.
A: Two search algorithms are:
Binary search
Linear search
Q: What is the purpose of sort algorithms?
A: Sort algorithms are used to arrange elements in a specified order.
Q: Name four sort algorithms.
A: Four sort algorithms are:
Bubble sort
Merge sort
Insertion sort
Selection sort
Q: How does the bubble sort algorithm work?
A: The bubble sort algorithm works by swapping elements until the array is sorted.
Q: How does the merge sort algorithm work?
A: The merge sort algorithm works on the divide and conquer approach.
Q: How does the insertion sort algorithm work?
A: The insertion sort algorithm works by comparing and interchanging elements to sort them.
Q: How does the selection sort algorithm work?
A: The selection sort algorithm works by making two sub-arrays and using the smallest element to sort the array.