Data Structures & Algorithms Flashcards
9 cards from real CPA practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 9 Data Structures & Algorithms flashcards as text
What is a linked list?
Answer: A data structure where each element points to the next
A linked list is a linear data structure where each element (node) points to the next node, allowing for efficient insertions and deletions.
What is a stack in data structures?
Answer: A collection where the last item added is the first to be removed
A stack is a collection of elements that follows the Last In, First Out (LIFO) principle.
What is the difference between an array and a linked list?
Answer: Arrays store data in contiguous memory, linked lists use nodes
Arrays store elements in contiguous memory locations, while linked lists store elements in nodes that are linked together.
What is a binary search tree?
Answer: A tree where left children are smaller than the parent
A binary search tree is a hierarchical data structure where each node has at most two children, and the left child is smaller than the parent.
What is a hash table?
Answer: A key-value pair storage structure
A hash table is a data structure that uses a hash function to map keys to values, allowing for fast access and insertion.
What is the purpose of an algorithm?
Answer: To solve a problem in a series of steps
An algorithm is a step-by-step process used to solve a problem or complete a task efficiently.
What is the time complexity of accessing an element in an array?
Answer: O(1)
Accessing an element in an array is an O(1) operation, meaning it is done in constant time.
What is the purpose of quicksort in algorithms?
Answer: To sort elements by dividing and conquering
Quicksort is a sorting algorithm that uses divide and conquer to efficiently sort elements by recursively partitioning the array.
What is a queue in data structures?
Answer: A data structure that follows FIFO
A queue is a fundamental linear data structure that operates on the First-In, First-Out (FIFO) principle. This means the first element added to the queue is always the first one to be removed, much like a line of people waiting. Elements are added at the 'rear' and removed from the 'front' of the queue.