← All CCS Flashcard Decks

Data Structures and Algorithms Flashcards

6 cards from real CCS practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 6 Data Structures and Algorithms flashcards as text
  1. What is the time complexity of searching in a balanced binary search tree?

    Answer: O(log n)

    A balanced BST halves the search space at each step, resulting in logarithmic time complexity.

  2. Which data structure operates on a Last-In-First-Out (LIFO) principle?

    Answer: Stack

    A stack follows LIFO ordering — the most recently added element is the first to be removed.

  3. What is a hash collision?

    Answer: When two different keys produce the same hash value

    A hash collision occurs when different inputs map to the same index in a hash table, requiring collision resolution.

  4. What is the main advantage of a linked list over an array?

    Answer: Efficient insertion and deletion without shifting elements

    Linked lists allow O(1) insertion and deletion at known positions without moving other elements, unlike arrays.

  5. Which sorting algorithm has the best average-case time complexity?

    Answer: Merge Sort with O(n log n)

    Merge Sort consistently achieves O(n log n) time complexity using a divide-and-conquer approach.

  6. What is the purpose of a queue data structure?

    Answer: To process elements in First-In-First-Out (FIFO) order

    Queues process elements in FIFO order, like a line at a store — first to arrive is first to be served.