Prep Guide Flashcards
What is a data structure?
A data structure is a way of organizing and storing data in a computer so that it can be accessed and modified efficiently.
What is an algorithm?
An algorithm is a step-by-step procedure or formula for solving a problem or accomplishing some end.
What is the difference between an array and a linked list?
An array stores elements of the same type in contiguous memory locations, while a linked list stores elements in nodes that are not necessarily adjacent in memory.
What is a stack?
A stack is a data structure that follows the Last In, First Out (LIFO) principle, where elements are inserted and removed from the same end.
What is a queue?
A queue is a data structure that follows the First In, First Out (FIFO) principle, where elements are inserted at the rear and removed from the front.
What is a binary search tree?
A binary search tree is a data structure that allows for efficient search, insertion, and deletion operations, where each node has at most two children.
What is a hash table?
A hash table is a data structure that stores key-value pairs, using a hash function to map keys to index locations for efficient retrieval.
What is a sorting algorithm?
A sorting algorithm is an algorithm that puts elements of a list in a certain order, such as numerical or lexicographical.
What is the time complexity of binary search?
The time complexity of binary search is O(log n), where n is the number of elements in the array.
What is the purpose of Big O notation?
Big O notation is used to describe the upper bound of the time or space complexity of an algorithm in terms of the input size.
What is recursion?
Recursion is a programming technique where a function calls itself in order to solve smaller instances of the same problem.
What is dynamic programming?
Dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems and solving each subproblem only once.
What is an adjacency list?
An adjacency list is a way to represent a graph as a collection of linked lists, where each list represents the neighbors of a vertex.
What is a priority queue?
A priority queue is a data structure that allows for efficient retrieval of the highest (or lowest) priority element.
What is a trie?
A trie is a tree-like data structure used to store a dynamic set of strings, where each node represents a common prefix of the strings.
What is a heap?
A heap is a specialized tree-based data structure that satisfies the heap property, where the key of each node is either greater than or equal to (max heap) or less than or equal to (min heap) the keys of its children.
What is the difference between breadth-first search and depth-first search?
Breadth-first search explores all neighbor nodes at the present depth prior to moving on to the nodes at the next depth level, while depth-first search explores as far as possible along each branch before backtracking.
What is memoization?
Memoization is an optimization technique used to store the results of expensive function calls and return the cached result when the same inputs occur again.
What is the significance of time complexity analysis?
Time complexity analysis helps in understanding how the runtime of an algorithm grows with the input size, enabling comparisons of efficiency among different algorithms.
What is the difference between a singly linked list and a doubly linked list?
A singly linked list allows traversal only in one direction, while a doubly linked list allows traversal in both directions.
What is the difference between a breadth-first search and a depth-first search?
Breadth-first search explores all neighbor nodes at the present depth prior to moving on to the nodes at the next depth level, while depth-first search explores as far as possible along each branch before backtracking.
What is the space complexity of quicksort?
The space complexity of quicksort is O(log n) on average, where n is the number of elements in the array.
What is the difference between a binary tree and a binary search tree?
A binary tree can have any value in each node, while a binary search tree follows the property that the left subtree of a node contains only nodes with values less than the node’s value, and the right subtree contains only nodes with values greater than the node’s value.
What is the difference between a graph and a tree?
A tree is a type of graph that contains no cycles and has a single root, while a graph can have cycles and multiple disconnected components.