🌍 Data Structure and Algorithm · flashcards

Data Structure and Algorithm Data Structures Flashcards

51 question-and-answer cards covering Data Structures as it is examined in Data Structure and Algorithm. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.

51Cards in deck
24Free preview
51Syllabus topics
~163Chars per answer
FreePrice

24 sample cards from the Data Structures deck

Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.

  1. Why is deleting a node (given a pointer to it) $O(n)$ in a singly linked list?

    Because the singly linked node has no prev pointer; you must traverse from the head to find the predecessor in order to update its next pointer to bypass the deleted node.

  2. Name three applications of linked lists.

    Implementing stacks and queues, dynamic memory management (free lists), undo/redo functionality, hash table chaining for collision handling, polynomial representation, and adjacency lists for graphs.

  3. How are linked lists used to implement polynomials?

    Each node stores a term's coefficient and exponent, and nodes are linked in order of exponents. This allows efficient representation and addition/multiplication of sparse polynomials.

  4. What is a stack and which principle governs it?

    A stack is a linear data structure that follows the LIFO (Last-In, First-Out) principle: the most recently inserted element is the first one removed.

  5. Name the two primary operations of a stack and what each does.

    Push — adds (inserts) an element to the top of the stack. Pop — removes and returns the element from the top of the stack.

  6. What do the peek (top) and isEmpty operations do on a stack?

    peek/top returns the element at the top without removing it. isEmpty returns true if the stack contains no elements (top indicator points below the first position).

  7. What is the time complexity of push, pop, and peek operations on a stack?

    All are $O(1)$ — constant time — since they only operate on the top element.

  8. In an array implementation of a stack, what does the 'top' variable represent and what is its initial value for an empty stack?

    'top' is the index of the topmost element. For an empty stack it is initialized to $-1$ (no elements). It increments on push and decrements on pop.

  9. What is stack overflow in an array-based stack implementation?

    Stack overflow occurs when a push is attempted while the stack is full — i.e., when $top = size - 1$ — and there is no room for a new element.

  10. What is stack underflow?

    Stack underflow occurs when a pop or peek is attempted on an empty stack (when $top = -1$), so there is no element to remove or return.

  11. What is the main disadvantage of an array implementation of a stack?

    Its size is fixed (static), so it can overflow when full, and it may waste memory if the allocated capacity is larger than needed. Resizing requires copying.

  12. In a linked list implementation of a stack, where are push and pop performed and why?

    At the head (front) of the list, because insertion and deletion at the head are $O(1)$, giving constant-time push and pop without traversal.

  13. What is the advantage of a linked list implementation of a stack over an array implementation?

    It is dynamic — it grows and shrinks as needed, so there is no fixed-capacity overflow (limited only by available memory) and no wasted preallocated space.

  14. Compare array vs linked list implementations of a stack in terms of memory.

    The array version uses contiguous fixed memory with no per-element pointer overhead but may waste or overflow space. The linked list version uses dynamic memory with extra pointer overhead per node but no fixed capacity.

  15. Name three applications of stacks.

    Function call management (call stack/recursion), expression evaluation and conversion (infix to postfix/prefix), balanced parentheses checking, undo/redo operations, backtracking, and depth-first search (DFS).

  16. How is a stack used in evaluating arithmetic expressions?

    A stack holds operands (and/or operators) during evaluation of postfix/prefix expressions, and is used to convert infix to postfix, ensuring correct operator precedence and order of operations.

  17. Why is a stack used to manage recursive function calls?

    Each function call pushes an activation record (parameters, local variables, return address) onto the call stack; when a call returns, its record is popped — matching the LIFO nature of nested calls.

  18. What does the algorithm for checking balanced parentheses use a stack for?

    It pushes each opening bracket and pops on each closing bracket, checking the popped bracket matches. A balanced expression leaves the stack empty at the end with all matches correct.

  19. What is a queue and which principle governs it?

    A queue is a linear data structure that follows the FIFO (First-In, First-Out) principle: the first element inserted is the first one removed.

  20. What are the two ends of a queue called, and which operation happens at each?

    The rear (or back/tail), where enqueue (insertion) occurs, and the front (or head), where dequeue (removal) occurs.

  21. Name the two primary operations of a queue and what each does.

    Enqueue — adds an element at the rear of the queue. Dequeue — removes and returns the element from the front of the queue.

  22. What is the key behavioral difference between a stack and a queue?

    A stack is LIFO (last-in, first-out) — insertion and removal occur at the same end (top). A queue is FIFO (first-in, first-out) — insertion at the rear and removal at the front, opposite ends.

  23. Name three real-world applications of queues.

    CPU/process scheduling, print/job spooling, handling requests in web servers, breadth-first search (BFS), buffering data streams (I/O buffers), and call-center request handling.

  24. What problem does a circular queue solve compared to a simple linear array queue?

    A circular queue reuses freed front slots by wrapping the rear index around to the start, preventing the 'false overflow' where a linear array queue reports full even though dequeued space exists at the front.

What this deck covers

The Data Structures deck follows the Data Structure and Algorithm Data Structures syllabus — 8 chapters and 51 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 6.4 cards per chapter.

Answers are written to be recallable, not just readable — averaging about 163 characters, which is long enough to carry the reasoning and short enough to say out loud.

A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.

Data Structures flashcards FAQ

How many Data Structures flashcards are in this Data Structure and Algorithm deck?

51 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.

Are these Data Structure and Algorithm flashcards free?

Yes. The preview here is free to read with no signup, and the full 51-card deck is free inside the Examius app.

What do the Data Structures cards cover?

They follow the Data Structure and Algorithm Data Structures syllabus — 8 chapters and 51 topics — so the questions track what is actually examinable.

How should I use these flashcards?

Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.