← All AMCAT Flashcard Decks

Computer Programming: Data Structures Flashcards

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

Read the first 6 Computer Programming: Data Structures flashcards as text
  1. Which data structure is best suited for implementing a browser's back button (visit history)?

    Answer: Stack

    A stack (LIFO) is ideal for browser history: push each new page, pop to go back to the previous page.

  2. What is the time complexity of searching for an element in a balanced Binary Search Tree (BST)?

    Answer: O(log n)

    A balanced BST has height O(log n), so searching requires at most O(log n) comparisons.

  3. In a doubly linked list, each node contains:

    Answer: Data and two pointers (prev, next)

    A doubly linked list node has a data field and two pointers: prev and next.

  4. What is the output of an inorder traversal of a Binary Search Tree?

    Answer: Sorted ascending order

    Inorder traversal (Left-Root-Right) of a BST visits nodes in ascending sorted order due to the BST property.

  5. Which of the following operations is NOT O(1) for a hash table on average?

    Answer: Sort all elements

    Insert, delete, and search are O(1) average in a hash table. Sorting all elements requires O(n log n).

  6. What is the maximum number of nodes in a binary tree of height h (root at height 0)?

    Answer: 2^(h+1) minus 1

    A full binary tree of height h has 2^(h+1) − 1 nodes (sum of 1 + 2 + 4 + ... + 2^h).