Skip to content
L
LearnCoachAssist
Topics
AI
AI Agents (500 Questions)
AI Math (500 Questions)
AI Math Beginner
AI Search Results
Claude Code Prompts
Art & Design
Art History
Color Theory
Graphic Design Principles
Knitting And Crochet
Photography Exposure Triangle And Composition
Business
Accounting Basics
Customer Research
Economics
Excel Formulas For Financial Analysts
Go To Market Strategy
Browse all topics →
Packs
Featured Packs
Python Programming Essentials
Prompt Engineering
Prompting Claude Code
AI Agents and Autonomous Systems
SQL and Database Fundamentals
JavaScript Fundamentals
Algorithms and Data Structures
Git and Version Control
Browse all packs →
Learn
Learning Paths
AI Deck Generator
How it works
Quiz
Blog
Cheat Sheets
Pricing
Resources
Pricing
Compare
FAQ
About
Contact
Effective Studying Guide
Free Anki Decks
Log in
Start Free
Topics
AI
AI Agents (500 Questions)
AI Math (500 Questions)
AI Math Beginner
AI Search Results
Claude Code Prompts
Art & Design
Art History
Color Theory
Graphic Design Principles
Knitting And Crochet
Photography Exposure Triangle And Composition
Business
Accounting Basics
Customer Research
Economics
Excel Formulas For Financial Analysts
Go To Market Strategy
Browse all topics →
Packs
Python Programming Essentials
Prompt Engineering
Prompting Claude Code
AI Agents and Autonomous Systems
SQL and Database Fundamentals
JavaScript Fundamentals
Algorithms and Data Structures
Git and Version Control
Browse all packs →
Learn
Learning Paths
AI Deck Generator
How it works
Quiz
Blog
Cheat Sheets
Pricing
Resources
Pricing
Compare
FAQ
About
Contact
Effective Studying Guide
Free Anki Decks
Start Free
Log in
← Quit
Dsa Anki Deck Practice Exam
Question
1
of
50
60:00
Question 1
Dsa Anki Deck
What is an Algorithm?
Sorting is the process of arranging data in a particular format. Common sorting orders are numerical and lexicographical.
A problem is NP-Hard if every problem in NP can be reduced to it in polynomial time. NP-Hard problems are at least as hard as the hardest problems in NP, but they don't necessarily have to be in NP themselves.
An octree is a tree data structure in which each internal node has exactly eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants.
An algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.
Question 2
Dsa Anki Deck
What is Manacher's Algorithm?
The stable marriage problem is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element.
Manacher's algorithm is an algorithm that finds the longest palindromic substring in a string in linear time O(n).
A greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit.
A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.
Question 3
Dsa Anki Deck
What is a Graph?
In a binary tree: Left, Right, Root.
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph.
A problem is NP-Complete if it is in NP and every problem in NP is reducible to it in polynomial time. These are the hardest problems in NP.
A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.
Question 4
Dsa Anki Deck
What is Binary Search?
This algorithm finds a majority element (an element that appears more than n/2 times) in an array in O(n) time and O(1) space.
WAL is a family of techniques for providing atomicity and durability in database systems. The key concept is that modifications are written to a log file before they are applied to the main database files.
A Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value.
Binary Search is a searching algorithm for finding an element's position in a sorted array. It works by repeatedly dividing the search interval in half.
Question 5
Dsa Anki Deck
What is the Longest Increasing Subsequence (LIS)?
O(log n).
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order.
Decomposition is the process of breaking a graph into subgraphs to simplify the analysis or solution of graph problems. Examples include decomposition into connected components, biconnected components, or strongly connected components.
Huffman coding is a popular algorithm used for lossless data compression. It uses variable-length encoding where variable-length codes are assigned to input characters based on their frequencies.
Question 6
Dsa Anki Deck
What is Vertex Cover Problem?
The vertex cover problem is a classic optimization problem used in computer science to find a minimum size set of vertices such that each edge of the graph is incident to at least one vertex in the set. It is NP-complete.
Dinic's algorithm is a strongly polynomial algorithm for computing the maximum flow in a flow network. It improves on Edmonds-Karp by using a level graph and finding blocking flows.
A Fenwick tree or binary indexed tree is a data structure that can efficiently update elements and calculate prefix sums in a table of numbers.
Shadow paging is a technique used in database systems to provide atomicity and durability. It maintains two page tables: current and shadow. Updates are made to new pages, and the shadow table is switched to current on commit.
Question 7
Dsa Anki Deck
What is the difference between Recursion and Iteration?
Recursion involves a function calling itself, while iteration involves a loop repeating a process. Recursion can be more memory intensive due to stack overhead.
A bridge in a graph is an edge that, if removed, increases the number of connected components of the graph.
A Segment Tree is a data structure used for storing information about intervals or segments. It allows querying which of the stored segments contain a given point.
BFS is a traversing algorithm where you start traversing from a selected node (source or starting node) and traverse the graph layerwise thus exploring the neighbor nodes (nodes which are directly connected to source node) first, before moving towards the next level neighbors.
Question 8
Dsa Anki Deck
What is QuickSelect?
QuickSelect is a selection algorithm to find the kth smallest element in an unordered list. It is related to Quicksort and has an average time complexity of O(n).
A bridge in a graph is an edge that, if removed, increases the number of connected components of the graph.
A Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value.
The Simplex algorithm is a popular algorithm for linear programming. It moves along the edges of the feasible region (polytope) to find the optimal solution.
Question 9
Dsa Anki Deck
What is a Priority Queue?
Alpha-beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree.
Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time.
A Priority Queue is an extension of queue with following properties: Every item has a priority associated with it. An element with high priority is dequeued before an element with low priority.
Dinic's algorithm is a strongly polynomial algorithm for computing the maximum flow in a flow network. It improves on Edmonds-Karp by using a level graph and finding blocking flows.
Question 10
Dsa Anki Deck
What is a Persistence Data Structure?
A multigraph is a graph which is permitted to have multiple edges (also called parallel edges), that is, edges that have the same end nodes.
Ternary search is a divide and conquer algorithm used to find the maximum or minimum of a unimodal function. It divides the search space into three parts.
A persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable.
Livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing.
Question 11
Dsa Anki Deck
What is a Van Emde Boas Tree?
A Van Emde Boas tree is a tree data structure which implements an associative array with integer keys. It performs all operations in O(log log M) time, where M is the maximum number of elements in the universe.
A disjoint-set data structure is a data structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets. It provides near-constant-time operations (bounded by the inverse Ackermann function) to add new sets, to merge existing sets, and to determine whether elements are in the same set.
Heavy-light decomposition is a technique for decomposing a rooted tree into a set of paths (chains) to allow efficient traversal and path queries (e.g., O(log^2 n)).
Brent's algorithm is a cycle detection algorithm that is generally faster than Floyd's Tortoise and Hare algorithm, although the worst-case time complexity is the same.
Question 12
Dsa Anki Deck
What is the Master Theorem?
Maximum Bipartite Matching is a problem of finding the maximum number of edges in a matching of a bipartite graph. A matching is a set of edges without common vertices.
Graham scan is a method of finding the convex hull of a finite set of points in the plane with time complexity O(n log n).
Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process.
The Master Theorem provides a solution for recurrence relations of the form T(n) = aT(n/b) + f(n), which often arise in the analysis of divide-and-conquer algorithms.
Question 13
Dsa Anki Deck
What is a Hash Table?
A Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value.
A skip list is a probabilistic data structure that allows O(log n) search complexity as well as O(log n) insertion complexity within an ordered sequence of elements.
The Z-Algorithm is a linear time string matching algorithm that finds all occurrences of a pattern in a text. It constructs a Z-array where Z[i] is the length of the longest common prefix between the string and its suffix starting at i.
In 0/1 Knapsack, items cannot be broken which means we should take the whole item or leave it. In Fractional Knapsack, we can break items for maximizing the total value of knapsack.
Question 14
Dsa Anki Deck
What is an AVL Tree?
The Ford-Fulkerson algorithm computes the maximum flow in a flow network. It uses DFS or BFS to find augmenting paths in the residual graph.
Mark and Sweep is a garbage collection algorithm. It has two phases: Mark (traverse all reachable objects and mark them) and Sweep (scan memory and reclaim unmarked objects).
Gaussian elimination is an algorithm for solving systems of linear equations. It is also used to find the rank of a matrix, the determinant of a matrix, and the inverse of an invertible square matrix.
An AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for all nodes.
Question 15
Dsa Anki Deck
What is the difference between B-Tree and B+ Tree?
A greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit.
In a B-Tree, keys and data are stored in both internal and leaf nodes. In a B+ Tree, all data is stored in the leaf nodes, and internal nodes only contain keys for indexing. B+ Trees usually have linked leaves for fast sequential access.
A k-d tree (k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space. It is a binary search tree with other constraints.
In 0/1 Knapsack, items cannot be broken which means we should take the whole item or leave it. In Fractional Knapsack, we can break items for maximizing the total value of knapsack.
Question 16
Dsa Anki Deck
What is Topological Sort (Kahn's Algorithm)?
The Master Theorem provides a solution for recurrence relations of the form T(n) = aT(n/b) + f(n), which often arise in the analysis of divide-and-conquer algorithms.
Kahn's algorithm is a topological sorting method for Directed Acyclic Graphs (DAGs). It works by repeatedly removing nodes with zero in-degree and updating the in-degrees of their neighbors.
Brent's algorithm is a cycle detection algorithm that is generally faster than Floyd's Tortoise and Hare algorithm, although the worst-case time complexity is the same.
Aho-Corasick is a string-searching algorithm that constructs a finite state machine from a set of pattern strings. It locates all occurrences of any of the patterns in a text.
Question 17
Dsa Anki Deck
What is Binary Lifting?
The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit.
A persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable.
Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and storing the results of subproblems to avoid computing the same results again.
Binary Lifting is a dynamic programming approach used to find the K-th ancestor of a node in a tree or to compute LCA efficiently in O(log n) time.
Question 18
Dsa Anki Deck
What is Amortized Analysis?
Common methods include Chaining (using a linked list at the index) and Open Addressing (Linear Probing, Quadratic Probing, Double Hashing).
ShellSort is mainly a variation of Insertion Sort. In insertion sort, we move elements only one position ahead. When an element has to be moved far ahead, many movements are involved. The idea of shellSort is to allow exchange of far items.
Amortized analysis is a method for analyzing a given algorithm's complexity, or how much of a resource, especially time or memory, it takes to execute. It considers the average cost of an operation over a sequence of operations, rather than the worst-case cost of a single operation.
Selection sort is a sorting algorithm that selects the smallest element from an unsorted list in each iteration and places that element at the beginning of the unsorted list.
Question 19
Dsa Anki Deck
What is Big O Notation?
Big O notation describes the upper bound of the time complexity of an algorithm. It represents the worst-case scenario.
A stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO (Last In First Out) or FILO (First In Last Out).
Convex Hull Trick is a geometry-based optimization technique used to optimize DP transitions that involve linear functions, typically reducing complexity from O(n^2) to O(n log n) or O(n).
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.
Question 20
Dsa Anki Deck
What is Lowest Common Ancestor (LCA)?
Big O notation describes the upper bound of the time complexity of an algorithm. It represents the worst-case scenario.
A splay tree is a self-adjusting binary search tree with the additional property that recently accessed elements are quick to access again. Operations perform a "splaying" step which moves the accessed element to the root.
Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time.
The LCA of two nodes v and w in a tree is the lowest (deepest) node that has both v and w as descendants.
Question 21
Dsa Anki Deck
What is Prim's Algorithm?
A greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit.
Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph.
Bit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word.
A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.
Question 22
Dsa Anki Deck
What is a Data Structure?
A data structure is a particular way of organizing data in a computer so that it can be used effectively.
Johnson's algorithm is a way to find the shortest paths between all pairs of vertices in an edge-weighted directed graph. It allows some of the edge weights to be negative numbers, but no negative-weight cycles may exist.
Ternary search is a divide and conquer algorithm used to find the maximum or minimum of a unimodal function. It divides the search space into three parts.
B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. It is a generalization of a binary search tree in that a node can have more than two children.
Question 23
Dsa Anki Deck
What is Longest Common Subsequence (LCS)?
The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences).
Cycle sort is an in-place, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes to the original array.
Enqueue (add item), Dequeue (remove item), Front (get first item), Rear (get last item).
A threaded binary tree is a binary tree variant that allows fast traversal: given a pointer to a node, it is possible to find the next node in the in-order traversal (or other traversals) without recursion or a stack.
Question 24
Dsa Anki Deck
What is a Circular Linked List?
A circular linked list is a linked list where all nodes are connected to form a circle. There is no NULL at the end.
An adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
A hypergraph is a generalization of a graph in which an edge can join any number of vertices. In contrast, in an ordinary graph, an edge connects exactly two vertices.
Breadth-first traversal of a tree.
Question 25
Dsa Anki Deck
What is Hashing?
Exponential search allows for searching in a sorted, unbounded list. The algorithm consists of two stages: determining a range where the search key resides and performing a binary search within that range.
Hashing is the process of converting a given key into another value, which is then used as an index to retrieve the value from the table.
Convex Hull Trick is a geometry-based optimization technique used to optimize DP transitions that involve linear functions, typically reducing complexity from O(n^2) to O(n log n) or O(n).
A spanning tree is a subset of Graph G, which has all the vertices covered with minimum possible number of edges. Hence, a spanning tree does not have cycles and it cannot be disconnected.
Question 26
Dsa Anki Deck
What is Time Complexity?
A multigraph is a graph which is permitted to have multiple edges (also called parallel edges), that is, edges that have the same end nodes.
Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph.
Time complexity is a measure of the amount of time an algorithm takes to run as a function of the length of the input.
Push (add item), Pop (remove item), Peek/Top (view top item), isEmpty (check if empty).
Question 27
Dsa Anki Deck
What is a Race Condition?
Graham scan is a method of finding the convex hull of a finite set of points in the plane with time complexity O(n log n).
A race condition occurs when two or more threads can access shared data and they try to change it at the same time. The result depends on the order of execution.
Merge Sort is a Divide and Conquer algorithm. It divides the input array into two halves, calls itself for the two halves, and then merges the two sorted halves.
Universally Unique Identifier (UUID) or Globally Unique Identifier (GUID) is a 128-bit label. In DSA, they are often used as keys where collision probability must be negligible without central coordination.
Question 28
Dsa Anki Deck
What is an XOR Linked List?
MinHash is a technique for quickly estimating how similar two sets are. It is often used to estimate the Jaccard similarity coefficient.
A greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit.
The Fast Fourier Transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). It reduces the complexity from O(n^2) to O(n log n).
An XOR linked list is a space-efficient implementation of a doubly linked list. Instead of storing two pointers (prev, next), it stores the XOR of the two pointers.
Question 29
Dsa Anki Deck
What is Selection Sort?
Hashing is the process of converting a given key into another value, which is then used as an index to retrieve the value from the table.
Selection sort is a sorting algorithm that selects the smallest element from an unsorted list in each iteration and places that element at the beginning of the unsorted list.
A B+ tree is an N-ary tree with a variable but often large number of children per node. A B+ tree consists of a root, internal nodes and leaves. The root may be either a leaf or a node with two or more children.
In a binary tree: Root, Left, Right.
Question 30
Dsa Anki Deck
What is Run-Length Encoding (RLE)?
Gaussian elimination is an algorithm for solving systems of linear equations. It is also used to find the rank of a matrix, the determinant of a matrix, and the inverse of an invertible square matrix.
CAS is an atomic instruction used in multithreading to achieve synchronization. It compares the contents of a memory location with a given value and, only if they are the same, modifies the contents to a new given value.
RLE is a simple form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count.
The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit.
Question 31
Dsa Anki Deck
What is DFS (Depth First Search)?
BWT is a block-sorting compression algorithm that rearranges a character string into runs of similar characters. It is useful for compression (like bzip2).
Interpolation Search is an improvement over Binary Search for instances, where the values in a sorted array are uniformly distributed. Binary Search always goes to the middle element to check. On the other hand, interpolation search may go to different locations according to the value of the key being searched.
Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space. It is defined to be the cosine of the angle between them.
DFS is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking.
Question 32
Dsa Anki Deck
What is Boyer-Moore Majority Vote Algorithm?
False sharing is a performance-degrading usage pattern that can arise in systems with distributed cache. It occurs when threads on different processors modify variables that reside on the same cache line.
This algorithm finds a majority element (an element that appears more than n/2 times) in an array in O(n) time and O(1) space.
A* Search algorithm is a graph traversal and path search algorithm, which is often used in computer science due to its completeness, optimality, and optimal efficiency. It uses a heuristic function to estimate the cost to reach the goal.
Radix sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. For elements with more than one significant digit, this bucketing process is repeated for each digit, while preserving the ordering of the prior step.
Question 33
Dsa Anki Deck
What is Linear Search?
Find: Determine which subset a particular element is in. Union: Join two subsets into a single subset.
Linear search is a very simple search algorithm. In this type of search, a sequential search is made over all items one by one.
A Monte Carlo algorithm is a randomized algorithm whose output may be incorrect with a certain (typically small) probability. Running it more times reduces the error probability.
A Fenwick tree or binary indexed tree is a data structure that can efficiently update elements and calculate prefix sums in a table of numbers.
Question 34
Dsa Anki Deck
What is Jaccard Similarity?
Jaccard similarity measures the similarity between two sets. It is defined as the size of the intersection divided by the size of the union of the sample sets.
A skip list is a probabilistic data structure that allows O(log n) search complexity as well as O(log n) insertion complexity within an ordered sequence of elements.
AND (&), OR (|), XOR (^), NOT (~), Left Shift (<<), Right Shift (>>).
Levenshtein distance measures difference between two sequences allowing insertions, deletions, and substitutions. Hamming distance only allows substitutions and requires strings of equal length.
Question 35
Dsa Anki Deck
What is the ABA Problem?
The stable marriage problem is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element.
HyperLogLog is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset. It uses very little memory.
The ABA problem occurs in lock-free programming when a location reads 'A', then changes to 'B', then back to 'A'. A thread may incorrectly assume the state hasn't changed.
O(n log n) in all 3 cases (worst, average and best).
Question 36
Dsa Anki Deck
What is TimSort?
Floyd’s Cycle-Finding Algorithm (Tortoise and Hare algorithm) is used to detect if a linked list contains a cycle.
Reservoir sampling is a family of randomized algorithms for choosing a simple random sample, without replacement, of k items from a population of unknown size n in a single pass over the items.
HyperLogLog is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset. It uses very little memory.
TimSort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, designed to perform well on many kinds of real-world data. It is the standard sort in Python and Java.
Question 37
Dsa Anki Deck
What is the time complexity of Binary Search?
A Monte Carlo algorithm is a randomized algorithm whose output may be incorrect with a certain (typically small) probability. Running it more times reduces the error probability.
O(log n).
A persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable.
RLE is a simple form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count.
Question 38
Dsa Anki Deck
What is a B+ Tree?
An octree is a tree data structure in which each internal node has exactly eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants.
Rabin-Karp algorithm is a string-searching algorithm that uses hashing to find any one of a set of pattern strings in a text. For text of length n and p patterns of combined length m, its average and best case running time is O(n+m) in space O(p), but its worst-case time is O(nm).
A sparse table is a data structure that allows answering range queries (like Range Minimum Query) on a static array in O(1) time after O(n log n) preprocessing.
A B+ tree is an N-ary tree with a variable but often large number of children per node. A B+ tree consists of a root, internal nodes and leaves. The root may be either a leaf or a node with two or more children.
Question 39
Dsa Anki Deck
What is Knapsack Problem?
O(n log n) in all 3 cases (worst, average and best).
Decomposition is the process of breaking a graph into subgraphs to simplify the analysis or solution of graph problems. Examples include decomposition into connected components, biconnected components, or strongly connected components.
A linked list is a linear data structure where elements are not stored at contiguous memory locations. The elements are linked using pointers.
The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.
Question 40
Dsa Anki Deck
What is Bit Manipulation?
Bit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word.
A greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit.
Square Root Decomposition is a technique used to answer range queries. It divides the array into blocks of size sqrt(n) to reduce query time complexity to O(sqrt(n)).
Arrays have fixed size and contiguous memory. Linked Lists have dynamic size and non-contiguous memory using pointers. Insertion/Deletion is easier in Linked Lists, while access is faster in Arrays.
Question 41
Dsa Anki Deck
What is a Binary Search Tree (BST)?
A BST is a binary tree where the left child contains only nodes with values less than the parent node, and the right child contains only nodes with values greater than the parent node.
Huffman coding assigns variable-length codes to input characters. Arithmetic coding encodes the entire message into a single number n where 0.0 <= n < 1.0. Arithmetic coding is generally more efficient but more complex.
A Mutex (Mutual Exclusion) is a locking mechanism used to synchronize access to a resource (only one owner). A Semaphore is a signaling mechanism (can allow N accesses).
Bellman-Ford is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph. It is slower than Dijkstra's but capable of handling graphs in which some of the edge weights are negative numbers.
Question 42
Dsa Anki Deck
What is Gaussian Elimination?
Gaussian elimination is an algorithm for solving systems of linear equations. It is also used to find the rank of a matrix, the determinant of a matrix, and the inverse of an invertible square matrix.
Johnson's algorithm is a way to find the shortest paths between all pairs of vertices in an edge-weighted directed graph. It allows some of the edge weights to be negative numbers, but no negative-weight cycles may exist.
A stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO (Last In First Out) or FILO (First In Last Out).
A problem is NP-Hard if every problem in NP can be reduced to it in polynomial time. NP-Hard problems are at least as hard as the hardest problems in NP, but they don't necessarily have to be in NP themselves.
Question 43
Dsa Anki Deck
What is Burrows-Wheeler Transform (BWT)?
Alpha-beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree.
The stable marriage problem is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element.
BWT is a block-sorting compression algorithm that rearranges a character string into runs of similar characters. It is useful for compression (like bzip2).
A Monte Carlo algorithm is a randomized algorithm whose output may be incorrect with a certain (typically small) probability. Running it more times reduces the error probability.
Question 44
Dsa Anki Deck
What is Backtracking?
Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time.
O(log n).
Count-Min Sketch is a probabilistic data structure that serves as a frequency table of events in a stream of data. It uses hash functions to map events to frequencies, but can overestimate counts.
Find: Determine which subset a particular element is in. Union: Join two subsets into a single subset.
Question 45
Dsa Anki Deck
What is Postorder Traversal?
An adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
A multigraph is a graph which is permitted to have multiple edges (also called parallel edges), that is, edges that have the same end nodes.
In a binary tree: Left, Right, Root.
Recursion involves a function calling itself, while iteration involves a loop repeating a process. Recursion can be more memory intensive due to stack overhead.
Question 46
Dsa Anki Deck
What is the Z-Algorithm?
The Edmonds-Karp algorithm is an implementation of the Ford-Fulkerson method for computing the maximum flow in a flow network in O(V E^2) time. It uses BFS to find augmenting paths.
IntroSort is a hybrid sorting algorithm that provides both fast average performance and (asymptotically) optimal worst-case performance. It begins with quicksort, switches to heapsort when the recursion depth exceeds a level, and uses insertion sort for small subarrays.
The Z-Algorithm is a linear time string matching algorithm that finds all occurrences of a pattern in a text. It constructs a Z-array where Z[i] is the length of the longest common prefix between the string and its suffix starting at i.
A k-d tree (k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space. It is a binary search tree with other constraints.
Question 47
Dsa Anki Deck
What is Branch Prediction?
O(n^2), usually when the array is already sorted or reverse sorted and the pivot is chosen poorly.
Branch prediction is a strategy used in CPU design to guess which way a branch (e.g., an if-then-else structure) will go before this is known for sure, to improve flow in the instruction pipeline.
Mark and Sweep is a garbage collection algorithm. It has two phases: Mark (traverse all reachable objects and mark them) and Sweep (scan memory and reclaim unmarked objects).
A Mutex (Mutual Exclusion) is a locking mechanism used to synchronize access to a resource (only one owner). A Semaphore is a signaling mechanism (can allow N accesses).
Question 48
Dsa Anki Deck
What is the Two Pointers technique?
Matrix Chain Multiplication is an optimization problem regarding the most efficient way to multiply a given sequence of matrices. The problem is not actually to perform the multiplications, but merely to decide in which order to perform the multiplications.
Two pointers is a pattern where two pointers iterate through the data structure in tandem until one or both of the pointers hit a certain condition.
Divide and Conquer is an algorithmic paradigm. A typical Divide and Conquer algorithm solves a problem using following three steps: Divide, Conquer, Combine.
Push (add item), Pop (remove item), Peek/Top (view top item), isEmpty (check if empty).
Question 49
Dsa Anki Deck
What is MinHash?
An adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
MinHash is a technique for quickly estimating how similar two sets are. It is often used to estimate the Jaccard similarity coefficient.
Bit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word.
Line intersection is the problem of finding the intersection point(s) of lines or line segments.
Question 50
Dsa Anki Deck
What is CAS (Compare And Swap)?
An octree is a tree data structure in which each internal node has exactly eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants.
CAS is an atomic instruction used in multithreading to achieve synchronization. It compares the contents of a memory location with a given value and, only if they are the same, modifies the contents to a new given value.
SPFA is an improvement of the Bellman-Ford algorithm which computes single-source shortest paths in a weighted directed graph. It works well on random sparse graphs but has a worst-case exponential time complexity.
The Z-Algorithm is a linear time string matching algorithm that finds all occurrences of a pattern in a text. It constructs a Z-array where Z[i] is the length of the longest common prefix between the string and its suffix starting at i.
Question navigator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
← Previous
Next →
✅ Submit Exam