Podcast
Questions and Answers
Remember that this final will be fully comprehensive of the entire course. Fill it out and familiarize yourself with all ______.
Remember that this final will be fully comprehensive of the entire course. Fill it out and familiarize yourself with all ______.
concepts
Fill in the table with the worst case and best case (if any) Big O time complexities for each ______.
Fill in the table with the worst case and best case (if any) Big O time complexities for each ______.
algorithm
O(h) is actually O(logn)
O(h) is actually O(logn)
True (A)
Which of these algorithms utilize the divide and conquer paradigm? (Select all that apply)
Which of these algorithms utilize the divide and conquer paradigm? (Select all that apply)
What is in-place sorting? Provide an example of a sorting algorithm that utilizes in-place sorting.
What is in-place sorting? Provide an example of a sorting algorithm that utilizes in-place sorting.
What is not in-place sorting? Provide an example of a sorting algorithm that utilizes not in-place sorting.
What is not in-place sorting? Provide an example of a sorting algorithm that utilizes not in-place sorting.
Explain the difference between stable and unstable sorting, provide examples for both based on what we have learned.
Explain the difference between stable and unstable sorting, provide examples for both based on what we have learned.
What property does a max-heap have to satisfy?
What property does a max-heap have to satisfy?
Explain how we can achieve the best case time complexity for Quicksort.
Explain how we can achieve the best case time complexity for Quicksort.
What are the three arrays we use for Counting-Sort, what do they do? (Select all that apply)
What are the three arrays we use for Counting-Sort, what do they do? (Select all that apply)
What policy does a Stack use, and why?
What policy does a Stack use, and why?
What policy does a Queue use, and why?
What policy does a Queue use, and why?
Here is an input sequence 123+45**+ use a stack to compute the sum, show all steps.
Here is an input sequence 123+45**+ use a stack to compute the sum, show all steps.
What are the two functions that add and remove from a Stack? (Select all that apply)
What are the two functions that add and remove from a Stack? (Select all that apply)
What attribute of a stack keeps track of the most recent element pushed into the stack?
What attribute of a stack keeps track of the most recent element pushed into the stack?
What two functions add and remove from a Queue? (Select all that apply)
What two functions add and remove from a Queue? (Select all that apply)
What are the two attributes that keep track of the index of the first element, and the index of the next location a new element can be inserted? (Select all that apply)
What are the two attributes that keep track of the index of the first element, and the index of the next location a new element can be inserted? (Select all that apply)
Define all the attributes that make up a tree structure.
Define all the attributes that make up a tree structure.
What is the binary search tree property?
What is the binary search tree property?
Given this Binary Search Tree, please list the order of the nodes following Inorder traversal, preorder traversal, and post order traversal. (Select all that apply)
Given this Binary Search Tree, please list the order of the nodes following Inorder traversal, preorder traversal, and post order traversal. (Select all that apply)
What is the max height and depth of the tree in question 22? (Select all that apply)
What is the max height and depth of the tree in question 22? (Select all that apply)
What are the 5 properties that satisfy a red black tree? (Select all that apply)
What are the 5 properties that satisfy a red black tree? (Select all that apply)
What is a sentinel for merge sort and red black tree?
What is a sentinel for merge sort and red black tree?
What is chaining in hash tables?
What is chaining in hash tables?
Why do we use dynamic programming? (Select all that apply)
Why do we use dynamic programming? (Select all that apply)
What type of trade off does dynamic programming incur?
What type of trade off does dynamic programming incur?
What algorithm do we use to calculate the minimum number of scalar products?
What algorithm do we use to calculate the minimum number of scalar products?
What are the two methods in finding the longest common subsequence?
What are the two methods in finding the longest common subsequence?
What is the output we want from the LCS algorithm?
What is the output we want from the LCS algorithm?
What is stored in the C and B table?
What is stored in the C and B table?
What does each arrow mean? Left, right, diagonal?
What does each arrow mean? Left, right, diagonal?
What are B-Trees?
What are B-Trees?
B-Trees copy pages from where? What does it then do?
B-Trees copy pages from where? What does it then do?
Every node other than the root must have how many keys?
Every node other than the root must have how many keys?
Every node may contain at most how many keys?
Every node may contain at most how many keys?
What are disjoint sets? What does Make-Set(x) do?
What are disjoint sets? What does Make-Set(x) do?
What are the two types of graphs? (Select all that apply)
What are the two types of graphs? (Select all that apply)
How can we calculate the maximum number of edges that can connect a set of nodes (vertices)?
How can we calculate the maximum number of edges that can connect a set of nodes (vertices)?
What are two standard ways to represent graph G=(V,E)? (Select all that apply)
What are two standard ways to represent graph G=(V,E)? (Select all that apply)
How do we traverse a graph using depth first search?
How do we traverse a graph using depth first search?
What makes a strongly connected component of a graph?
What makes a strongly connected component of a graph?
When we transpose a graph, what does that do?
When we transpose a graph, what does that do?
What is the goal of a minimum spanning tree?
What is the goal of a minimum spanning tree?
What 3 algorithms are considered greedy algorithms? (Select all that apply)
What 3 algorithms are considered greedy algorithms? (Select all that apply)
How does MST-Kruskals work? What about MST-Prims?
How does MST-Kruskals work? What about MST-Prims?
Know how to read and implement the Kruskals algorithm
Know how to read and implement the Kruskals algorithm
Know how to read and implement MST-Prims
Know how to read and implement MST-Prims
What solutions do we have to traverse every node in a graph, please list them all? (Select all that apply)
What solutions do we have to traverse every node in a graph, please list them all? (Select all that apply)
What solutions do we have to traverse every node in a graph, and find the shortest path (lowest cost) to connect all nodes together? Please list them all? (Select all that apply)
What solutions do we have to traverse every node in a graph, and find the shortest path (lowest cost) to connect all nodes together? Please list them all? (Select all that apply)
Please know how to read and implement, initialize single source, relax, and Bellman-ford algorithm
Please know how to read and implement, initialize single source, relax, and Bellman-ford algorithm
What do we want to avoid in the bellman-ford algorithm?
What do we want to avoid in the bellman-ford algorithm?
Does dijkstras algorithm allow you to have negative edge weight?
Does dijkstras algorithm allow you to have negative edge weight?
What is our goal with dijstraks algorithm? How does it work?
What is our goal with dijstraks algorithm? How does it work?
Flashcards
Worst Case Time Complexity
Worst Case Time Complexity
An algorithm's worst-case time complexity is the maximum amount of time it takes to complete, given the worst possible input.
Best Case Time Complexity
Best Case Time Complexity
An algorithm's best-case time complexity is the minimum amount of time it takes to complete, given the best possible input.
O(n^2)
O(n^2)
O(n^2) represents an algorithm's time complexity that grows quadratically with the input size (n). For example, if you double the input size, the execution time increases by four times.
O(nlogn)
O(nlogn)
Signup and view all the flashcards
O(logn)
O(logn)
Signup and view all the flashcards
O(k+n)
O(k+n)
Signup and view all the flashcards
O(n)
O(n)
Signup and view all the flashcards
O(2^n)
O(2^n)
Signup and view all the flashcards
Linear Data Structure
Linear Data Structure
Signup and view all the flashcards
Non-Linear Data Structure
Non-Linear Data Structure
Signup and view all the flashcards
Divide and Conquer Paradigm
Divide and Conquer Paradigm
Signup and view all the flashcards
In-Place Sorting
In-Place Sorting
Signup and view all the flashcards
Not In-Place Sorting
Not In-Place Sorting
Signup and view all the flashcards
Stable Sorting
Stable Sorting
Signup and view all the flashcards
Unstable Sorting
Unstable Sorting
Signup and view all the flashcards
Max-Heap Property
Max-Heap Property
Signup and view all the flashcards
Best Case Quicksort Complexity
Best Case Quicksort Complexity
Signup and view all the flashcards
Counting Sort Arrays
Counting Sort Arrays
Signup and view all the flashcards
Stack Policy
Stack Policy
Signup and view all the flashcards
Queue Policy
Queue Policy
Signup and view all the flashcards
Top attribute of a stack
Top attribute of a stack
Signup and view all the flashcards
Queue Functions
Queue Functions
Signup and view all the flashcards
Queue Attributes: Head and Tail
Queue Attributes: Head and Tail
Signup and view all the flashcards
Doubly Linked List
Doubly Linked List
Signup and view all the flashcards
Tree Structure Attributes
Tree Structure Attributes
Signup and view all the flashcards
Binary Search Tree Property
Binary Search Tree Property
Signup and view all the flashcards
Red-Black Tree
Red-Black Tree
Signup and view all the flashcards
Sentinel
Sentinel
Signup and view all the flashcards
Chaining in Hash Tables
Chaining in Hash Tables
Signup and view all the flashcards
Dynamic Programming
Dynamic Programming
Signup and view all the flashcards
Dynamic Programming Trade-off
Dynamic Programming Trade-off
Signup and view all the flashcards
Matrix-Chain Multiplication
Matrix-Chain Multiplication
Signup and view all the flashcards
LCS-Length Algorithm
LCS-Length Algorithm
Signup and view all the flashcards
Longest Common Subsequence
Longest Common Subsequence
Signup and view all the flashcards
B-Trees
B-Trees
Signup and view all the flashcards
B-Tree Page Copying
B-Tree Page Copying
Signup and view all the flashcards
B-Tree Node Key Constraint
B-Tree Node Key Constraint
Signup and view all the flashcards
Study Notes
Algorithm Time Complexities
- Insertion Sort: Worst case time complexity is O(n²).
- Merge Sort: Worst case time complexity is O(n log n).
- Heap Sort: Worst case time complexity is O(n log n).
- Quick Sort: Worst case time complexity is O(n²).
- Counting Sort: Worst case time complexity is O(k + n).
- Searching Hash Table: Worst case time complexity is O(n).
- Balanced Binary Search Tree: Worst case time complexity is O(log n) or O(h).
- Unbalanced Binary Search Tree: Worst case time complexity is O(n).
- Inorder, Postorder, Preorder search: Worst case time complexity is O(n).
- Cut-Rod: Worst case time complexity is O(2ⁿ).
- Longest Common Subsequence: Worst case time complexity is O(m + n).
- Breadth-first search: Worst case time complexity is O(|V| + |E|).
- Depth-first search: Worst case time complexity is O(|V| + |E|).
- Dijkstra's algorithm: Worst case time complexity is O(V log V + E).
Data Structures
- Linear:
- Array
- Stack
- Queue
- Linked List
- Non-linear:
- Tree
- Graph
- Hash Table
Divide and Conquer Algorithms
- Quicksort
- Merge Sort
- Binary Search
In-place Sorting
- Insertion Sort
- Characteristics: Does not require additional space (memory) for processing data, and does not rely on extra data structures.
Not In-place Sorting
- Merge Sort
- Characteristics: Requires additional space, usually equal to or greater than the original input data size, to manipulate the data during sorting. Also, more computationally efficient than in-place sorting in some cases.
Stable vs. Unstable Sorting
- Stable Sorting: Retains the original order of elements with equal values when sorting.
- Example: Merge Sort
- Unstable Sorting: Does not maintain the original order of equal elements.
- Example: Quicksort
Max-Heap Property
- A[Parent(i)] ≥ A[i]
Best Case Time Complexity of Quicksort
- Occurs when the pivot divides the array nearly in half during partitioning.
Counting Sort Arrays
- Input Array (A): The array containing the elements to be sorted.
- Output Array (B): The array where the sorted elements will be stored.
- Auxiliary Array (C): An extra array used to store the counts of each element in the input array.
Stack
- Policy: Last-In-First-Out (LIFO)
Queue
- Policy: First-In-First-Out (FIFO)
Sorting Algorithm Comparison
Binary Search Tree Property
- If y is a left subtree node of x, then y.key ≤ x.key.
- If y is a right subtree node of x, then y.key ≥ x.key.
Binary Search Tree Traversal Orders
- Inorder: 25, 30, 35, 40, 45, 50, 60
- Postorder: 25, 35, 30, 45, 60, 50, 40
- Preorder: 40, 30, 25, 35, 50, 45, 60
Red-Black Tree Properties
- Every node is either red or black.
- The root is black.
- Every leaf (NIL) is black.
- If a node is red, then both its children are black.
- All paths from a given node to the descendant leaves contain the same number of black nodes.
Sentinel
- A sentinel is a special value or element used in a data structure as a boundary marker.
Chaining in Hash Tables
- When multiple keys hash to the same index, these entries are linked together in a chain/linked list.
Dynamic Programming
- Breaks down a problem into smaller overlapping subproblems and saves the solutions.
- Avoids redundant calculations.
- Used for optimization problems.
Time-Memory Trade-Off
- Dynamic programming's use of extra memory can speed up calculations for optimization problems.
Matrix Chain Multiplication
- An algorithm for calculating the minimum number of scalar products for multiplying matrices.
Length of Longest Common Subsequence Algorithm Implementation
- The problem involves finding the length of a longest common subsequence using algorithms that solve sub-problems and store their results, and then combine them to solve more complex problems. Tables are used to store the results of sub-problems, and the values are retrieved as needed.
B-Trees
- Balanced search trees optimized for disk access.
Graph Traversal
- Depth-First Search (DFS): Explore as deeply as possible along a branch before backtracking.
- Breadth-First Search (BFS): Explore all vertices at a given distance from the source before moving to the next level.
Strongly Connected Components
- In a directed graph, a strongly connected component (SCC) is a maximal set of vertices where each vertex in the set is reachable from every other vertex.
Transposing a Graph
- Swapping the direction of all edges in a directed graph results in a new graph. This change in direction of edges is a common step in some graph algorithms to analyze specific properties.
Disjoint Sets
- A data structure for managing a collection of disjoint sets (collections of elements that are not in any other sets).
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.