Algorithms Homework 2 Each question is 20 pts Let us modify the

Algorithms Homework 2

Each question is 20 pts

Let us modify the example on Slide 8 of Chapter 6 by replacing the 6 on the right-hand-side of the first equation by 16. Redo the example.

Solve the example on Slide 14 of Chapter 7 using Boyer-Moore and Horspool algorithms. Which one works faster on this example?

Chapter 7 Slide 20, first insert KID and then delete ARE. What is your algorithm? Describe it step by step.

In Chapter 8, Slide 13, consider inserting a new item, Item-5 with 3kg weight and $25 value. What is the solution, show your steps.

Explain the following two questions below.

1: What is the Partition problem? Describe how you would solve it.

2: Explain the following briefly

Chapter 6 Slide 35, why is the time complexity of heapsort is n x log(n)

What is Dynamic Programming?

Why is the dynamic programming solution to Knapsack problem considered as a pseudo-polynomial-time algorithm (instead of polynomial-time).

For questions 3 and 4, give your pseudocode algorithm as well (there will be 10 pts penalty without the pseudocode for each question).