FlashKeepers

Computer Science · College · College and University

Algorithms: Complexity and Common Patterns

Big O notation, common sorting and searching algorithms, and recursion patterns tested in technical interviews and coursework.

About this set

38 basic cards for College Computer Science. Set 1 of 5 in Algorithms. It opens with "What does Big O notation measure?" and "Define O(1) time complexity". Study it alongside the other College sets below.

38 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What does Big O notation measure?
Show answerHow the runtime or space requirements of an algorithm grow as input size increases.
Define O(1) time complexity.
Show answerConstant time; the runtime does not change regardless of input size.
Define O(n) time complexity.
Show answerLinear time; runtime grows proportionally with input size n.
Define O(log n) time complexity.
Show answerLogarithmic time; runtime grows with the logarithm of input size.
Define O(n^2) time complexity.
Show answerQuadratic time; runtime grows with the square of input size.
Define O(n log n) time complexity.
Show answerLinearithmic time; runtime is n times the logarithm of n.
Define O(2^n) time complexity.
Show answerExponential time; runtime doubles with each increase in input size.
What is the time complexity of accessing an array element by index?
Show answerO(1) constant time.
What is the time complexity of searching an unsorted array for a value?
Show answerO(n) linear time.
What is the time complexity of binary search on a sorted array?
Show answerO(log n) logarithmic time.
What must be true about an array before binary search can be used?
Show answerThe array must be sorted.
What is the time complexity of inserting an element at the beginning of an array?
Show answerO(n) linear time.
What is the time complexity of appending an element to a dynamic array with available capacity?
Show answerO(1) amortized constant time.
What is the average time complexity of searching a hash table?
Show answerO(1) constant time with a good hash function.
What is the time complexity of quicksort in the average case?
Show answerO(n log n) linearithmic time.

23 more cards in the app

Study this set free