40 likes | 173 Vues
In this discussion, we explore the impact of doubling the input size on various search and sorting algorithms, including linear search, binary search, and simple sorting algorithms like bubble sort. We will answer critical questions regarding the time complexities associated with these algorithms and how they scale with input size. Additionally, we will discuss optimization in route calculations, highlighting the effects of adding additional stops to a tour. This analysis is crucial for understanding algorithm efficiency in computational problems.
E N D
Ask the class – Q1 • How much longer will it take if you double the input for a linear search? A: same time B: a little longer C: 2x longer D: 4x longer
Ask the class – Q2 • How much longer will it take if you double the input for a binary search? A: same time B: a little longer C: 2x longer D: 4x longer
Ask the class – Q3 • How much longer will it take if you double the input for a simple sorting algorithm (e.g. bubble sort)? A: same time B: a little longer C: 2x longer D: 4x longer
Ask the class – Q4 • Mary has to visit 99 computer stores on her summer tour. • How much longer will it take to calculate the optimal tour if we add 1 more store? A: a little longer B: twice as long C: 4x longer D:100x longer