Podcast
Questions and Answers
In the worst case scenario, how does the number of comparisons in insertion sort behave?
In the worst case scenario, how does the number of comparisons in insertion sort behave?
- Increases quadratically (correct)
- Decreases linearly
- Remains constant
- Doubles exponentially
For the best case scenario in insertion sort, how many comparisons are executed per outer loop?
For the best case scenario in insertion sort, how many comparisons are executed per outer loop?
- Thrice
- Never
- Twice
- Once (correct)
What happens to the number of comparisons made by insertion sort in the average case compared to decreasing arrays?
What happens to the number of comparisons made by insertion sort in the average case compared to decreasing arrays?
- Halved (correct)
- Remains the same
- Increases exponentially
- Doubled
Which sorting algorithm is known for 'bubbling up' the largest element to the last position in each pass?
Which sorting algorithm is known for 'bubbling up' the largest element to the last position in each pass?
What is the time complexity of the best and average case scenarios in Quick Sort?
What is the time complexity of the best and average case scenarios in Quick Sort?
In Merge Sort, how is the original array split before sorting?
In Merge Sort, how is the original array split before sorting?
What is the time complexity of Prims Algorithm when using a Priority Queue?
What is the time complexity of Prims Algorithm when using a Priority Queue?
In preorder traversal of a binary tree, what is visited first?
In preorder traversal of a binary tree, what is visited first?
What is the main purpose of A* algorithm?
What is the main purpose of A* algorithm?
What defines the weight of a tree in the context of minimum spanning trees?
What defines the weight of a tree in the context of minimum spanning trees?
Which algorithm is used to find the shortest paths from a single source vertex to all other vertices in a weighted graph with non-negative edge weights?
Which algorithm is used to find the shortest paths from a single source vertex to all other vertices in a weighted graph with non-negative edge weights?
What kind of solution does Greedy Search construct in optimization problems?
What kind of solution does Greedy Search construct in optimization problems?
Flashcards
Worst Case Scenario: Insertion Sort
Worst Case Scenario: Insertion Sort
In the worst-case scenario, for each element in the unsorted portion of the array, insertion sort might need to compare it against all elements in the already sorted portion.
Best Case Scenario: Insertion Sort
Best Case Scenario: Insertion Sort
For sorted arrays, insertion sort performs only one comparison per outer loop because it finds the correct position for an element in the first iteration.
Average Case Scenario: Insertion Sort
Average Case Scenario: Insertion Sort
The average case scenario in insertion sort has about half the comparisons needed in decreasing arrays because it will find the correct position for an element faster.
Bubble Sort
Bubble Sort
Signup and view all the flashcards
Best & Average Time Complexity: Quick Sort
Best & Average Time Complexity: Quick Sort
Signup and view all the flashcards
Merge Sort: Splitting the Array
Merge Sort: Splitting the Array
Signup and view all the flashcards
Prim's Algorithm with Priority Queue
Prim's Algorithm with Priority Queue
Signup and view all the flashcards
Preorder Traversal: Root First
Preorder Traversal: Root First
Signup and view all the flashcards
A* Algorithm Purpose
A* Algorithm Purpose
Signup and view all the flashcards
Minimum Spanning Tree: Weight
Minimum Spanning Tree: Weight
Signup and view all the flashcards
Dijkstra's Algorithm
Dijkstra's Algorithm
Signup and view all the flashcards
Greedy Search
Greedy Search
Signup and view all the flashcards