Define data structure.
A way to organize and store data for efficient access and modification.
What is the time complexity of accessing an element in an array?
O(1), meaning constant time regardless of the array size.
True or false: A linked list allows for efficient insertions and deletions.
TRUE
Linked lists can insert or delete nodes without shifting elements.
Fill in the blank: A stack follows the _______ principle.
Last In, First Out (LIFO)
What is a queue?
A data structure that follows the First In, First Out (FIFO) principle.
Define binary tree.
A tree data structure where each node has at most two children.
What is the height of a tree?
The length of the longest path from the root to a leaf node.
True or false: A hash table provides average O(1) time complexity for lookups.
TRUE
This efficiency depends on a good hash function and low collision rate.
What is merge sort?
A divide-and-conquer algorithm that sorts by merging sorted subarrays.
Define graph.
A collection of nodes connected by edges, representing relationships.
Fill in the blank: In a binary search tree, the left child is _______ than the parent.
less than
What is Big O notation?
A mathematical notation to describe the upper limit of an algorithm’s time or space complexity.
True or false: Depth-first search explores all neighbors before going deeper.
FALSE
Depth-first search goes as deep as possible before backtracking.
What is the space complexity of an algorithm?
The amount of memory space required by the algorithm as a function of input size.
Define dynamic programming.
An optimization technique that solves problems by breaking them down into simpler subproblems.
Fill in the blank: A priority queue allows elements to be processed based on their _______.
priority
What is a trie?
A tree-like data structure used to store a dynamic set of strings.
True or false: Breadth-first search uses a stack for traversal.
FALSE
Breadth-first search uses a queue to explore nodes level by level.
What is a subarray?
A contiguous portion of an array.
Define algorithm.
A step-by-step procedure for solving a problem or performing a task.
Fill in the blank: The selection sort algorithm repeatedly selects the _______ element.
smallest
What is the worst-case time complexity of quicksort?
O(n^2), occurring when the pivot is the smallest or largest element.
True or false: A balanced tree maintains its height to be logarithmic in relation to the number of nodes.
TRUE
Balanced trees ensure efficient operations like insertion and deletion.
What is a singly linked list?
A linked list where each node points to the next node and has no backward link.