Computer Science: Algorithms
Sorting, searching, recursion, and algorithm analysis — essential CS concepts.
Study these flashcards with spaced repetition
Track your progress, master difficult cards, and export to Anki. Free to start.
Start Studying — FreeFlashcards in This Deck
What does Big O notation represent in the context of algorithm analysis?
Big O notation describes the upper bound of an algorithm's growth rate, characterizing the worst-case execution time or space requirements as the input size (n) approaches infinity.
What is the worst-case time complexity of the Bubble Sort algorithm?
O(n^2), where n is the number of elements in the input list, due to the nested loops required to compare and swap elements.
What is the auxiliary space complexity of a standard Merge Sort implementation?
O(n), because the algorithm requires a temporary array of the same size as the input to merge the divided sub-arrays.
What is the primary pre-condition for an input array before performing a Binary Search?
The input array must be sorted in either ascending or descending order for the divide-and-conquer logic to function correctly.
Which data structure is typically used to implement Breadth-First Search (BFS)?
A Queue (FIFO - First In, First Out) is used to keep track of the nodes to be visited in the order they were discovered.
What are the two essential components required for a valid recursive function?
A base case (to terminate the recursion) and a recursive step (which calls the function again with a smaller input to move toward the base case).
Between O(n log n) and O(n^2), which complexity is more efficient for large input sizes, and why?
O(n log n) is more efficient because its growth rate is significantly slower than the quadratic growth of O(n^2) as the input size n increases.
Why is Quick Sort often preferred over Merge Sort in practice, despite Quick Sort's O(n^2) worst-case time complexity?
Quick Sort is an in-place algorithm (requiring only O(log n) auxiliary space) and typically exhibits better cache locality and smaller constant factors than Merge Sort.
What does it mean for a sorting algorithm to be 'stable'?
A sorting algorithm is stable if it preserves the relative order of records with equal keys (values) from the original input.
What is the time complexity of Binary Search, and why?
O(log n), because the algorithm halves the search space in every iteration, leading to a logarithmic number of steps relative to the input size.
+10 more cards — sign up to see all
Frequently Asked Questions
How many flashcards are in this Computer Science: Algorithms deck?
This deck contains 20 flashcards with a mix of difficulty levels: 6 easy, 10 medium, and 4 hard cards.
Is this flashcard deck free to use?
Yes! You can study these flashcards for free with our spaced repetition system. Create a free account to track your progress and save your study history.
Can I export these flashcards to Anki?
Pro users can export any deck to Anki (.apkg format) with one click. Free users can export to CSV. Start studying for free and upgrade when you need Anki export.
What is spaced repetition?
Spaced repetition is a study technique that shows you cards at increasing intervals based on how well you know them. Cards you struggle with appear more often, while mastered cards are shown less frequently. This is proven to be one of the most effective ways to memorize information.
Related Flashcard Decks
Ready to study?
Create a free account and start studying these flashcards with spaced repetition.
Get Started — Free