Data Structures, unit: Searching and Complexity Analysis. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.
26 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a search algorithm?
- An algorithm for finding a specific element or condition within a data structure
- What is linear search?
- Checking each element in sequence until the target is found or the list ends
- What is the time complexity of linear search?
- O(n)
- What is binary search?
- Repeatedly halving a sorted list's search range by comparing the middle element to the target
- What is the time complexity of binary search?
- O(log n)
- What precondition must be true for binary search to work correctly?
- The data must already be sorted
- What is Big O notation used for?
- Describing the upper bound of an algorithm's time or space complexity as input size grows
- What does O(1) time complexity mean?
- Constant time, unaffected by input size
- What does O(n) time complexity mean?
- Linear time, growing proportionally with input size
- What does O(n^2) time complexity mean?
- Quadratic time, common in algorithms with nested loops over the input
- What does O(log n) time complexity mean?
- Logarithmic time, where the problem size is repeatedly halved
- What does O(n log n) time complexity mean?
- Linearithmic time, typical of efficient comparison-based sorting algorithms
- What is best-case complexity?
- The minimum time or space an algorithm requires, under the most favorable input
- What is worst-case complexity?
- The maximum time or space an algorithm requires, under the least favorable input
- What is average-case complexity?
- The expected time or space an algorithm requires, averaged over typical inputs