Write the dynamic programming code to compute c

Assignment Help Basic Computer Science
Reference no: EM131038629

1. For each recurrence relation below, indicate show and justify its theta class:

a. T(1) = 1; T(n) = 2T(n/2)+5

b. T(1) = 1; T(n) = 2T(n/2) + 2n

c. T(1) = 1; T(n) = T(3n/4) + T(n/6) + 5n

d. Solve the following recurrence T(1) = 1; T(n) = 3T(n/3) + 3

e. Let a and b be real numbers such that 0<a<b. Show that na is in O(nb), but nb is not in O(na).

f. Explain why the best case running time of Insertion Sort is O(n) .

Dynamic Programming

2.  Assume k is odd and let O(n,k) be the number of ways to write n as the sum of odd positive integers each at most k but not necessarily distinct. Find a recurrence for O(n,k) and explain it.

3. Consider the following recurrence (given a sequence pi) :
with C[i,i] = 0

a. Draw the table dynamic programming would use to implement this.

b. Write the dynamic programming code to compute C.

Greedy Algorithms

4. In the bin-packing problem, you are given a set of objects with sizes s1, s2, ... ,sn where 0<si<1 (si is the fraction of a box that the ith item will fill). You are to determine to put them in a few boxes of size 1 as possible.

a.Give a greedy strategy for this problem.

b. (What order would you have to process the items in order for your solution to be optimal?

 5. Consider the following algorithm. T is a binary tree.
fred(T)
{
if (T is null)
return 0
else return (fred(left child of T) + fred(right child of T)
}

a. Give the recurrence relation for the fred function. You do not need to solve the equation, but remember the basis.

b. What does the function fred do?

Mergeable Heaps

6. Why did Binomial heaps NOT require the mark bits and the rules about losing two children?

7. The H be a fibonacci heap with a B4 and a B5 with the min at the root of the B5. Show the structure that would result from ExtractMin(H).

Applying what we have learned

8. Find the most efficient solution for each of the problems below and analyze its running time. In each case, you are given n points in the plane,

Hint, the distance from the origin to the ith point is
a. Find the smallest circle, centered at the origin, containing all of the points in its interior.

b. Determine whether it is possible to draw a circle centered at the origin containing two or more of the points on its boundary.

c. Given k satisfying 0<=k<=n, find a circle, centered at the origin, such that at most k of the points are in the interior of the circle and at most n-k of the points are in the exterior of the circle.

9. Graph Algorithm Details

a. Define the three types of shortest path problems.

b. Give an example where the shortest path tree from Dijkstra's algorithm is not a minimum spanning tree.

c. Show the DFS forest resulting from running DFS on the graph described by this adjacency list. Label each node with its start and finish times.

1: 2, 5,

2: 1, 3, 5

3: 1, 2, 5

4: 2, 3, 6

5: 1, 2, 3

6: 2, 3, 4

Running Shortest Path Algorithms

10. Show the execution of Prim's algorithm starting at node A on the following graph. Redraw the diagram for each edge that is added (yes, you can write neatly on this entire page)

NP-Completeness

11. Prove that this problem is in NP: Given n, a number of dice, there are at least k ways of rolling a given value, y.

12. Explain exactly what you have to do to prove that a problem is NP-Complete

13. Which of the following statements is true for all problems X and Y in NP such that X is reducible to Y in polynomial time? (T or F after each one - yes, that can be outside of a box)

a. If Y is NP-complete, then X is NP-complete

b. If Y is in P, then X is in P

c. If X is NP-complete, then Y is in P

d. If Y is not in P, then X is not in P

14.We said that if we had a polynomial time solution to an NP-complete problem X, we would have a polynomial-time solution to every problem in NP. Explain the polynomial-time solution for an arbitrary problem Y in NP.

15.If you have to solve a problem that is NP-Complete, what options do you have?

Reference no: EM131038629

Questions Cloud

Describe the rationale the target audience : Research and create a training project that will promote understanding of conflicts cause, impact, parties involved, conflict styles, and strategies for conflict management or resolution.
Calculate the gross regular pay : The spreadsheet has five tabs: Employee, Department, Time Sheets, Deductions, and Deduction Types. On a new sixth tab, calculate the payroll information for the first week of January 2012 (ending 1/7/2012). Do not delete any data on the other five..
Identify the common roles in a human resource project : Identify the common roles in a human resource project. Then, analyze these roles to typical human resource functions and Reorganize any two (2) roles at TriHealth that result in shared responsibilities and then state why you chose those two roles.
Online reading of strategic alliances : Consider the online reading of strategic alliances. What are some other advantages and disadvantages that you can think of as it pertains to strategic alliances?
Write the dynamic programming code to compute c : Assume k is odd and let O(n,k) be the number of ways to write n as the sum of odd positive integers each at most k but not necessarily distinct. Find a recurrence for O(n,k) and explain it.
Identify the possible impacts of the electric car technology : Identify and analyze the possible impacts (political, environmental, health, safety, cultural, economic) of the electric car technology on society (including individual, local, regional, or global context)?
Important differences in level effectiveness : Complete scenario 1 (in addition to scenario 4), provide insights on both scenarios and key differences between them in this reflection (e.g., what were some important differences in level effectiveness between scenario 1 and 4).
Formal orientation programmer : Q1) Does the company have an orientation programmer? Q2) If yes how effective is it? Q3) how is formal Orientation programmer conducted? Q4) If you were Navin what would have you done?
Write a review of a professional engineering journal article : Write a review of a professional engineering journal article. The article should come from a scholarly journal such as the American Society of Civil Engineers.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Using professional principles and standards

Design and develop the below queries using professional principles and standards: A set of SQL Statements that returns all rows and all data for each table in your database. Two SQL Statements that return a subset of columns and a subset of rows ..

  Determining contents of memory of specified address

Find the contents of memory from address 0x1800 up to, but not including, 0x1809, after this code is executed.

  Jones and smith have each decided to allocate

Suppose that Jones and Smith have each decided to allocate $1000 per year to an entertainment budget in the form of hockey games or rock concerts. They both like hockey games and rock concerts and will choose to consume positive quantities of both go..

  Proposal for implementation of information technology

Investigate and present a proposal for the implementation of an Information Technology (IT) system for a small (4-user) business section (for example, Human Resources) of an organization of your choice (real or fictitious).

  Article relevant to current social engineering threats

Select an article relevant to current social engineering threats.

  Discuss economic theory related to the quote

Question/Prompt: "In 2014, "the United States exported $2.34 trillion worth of goods and services-an all-time record. Exports from the United States in 2014 equaled the entire gross domestic product of Brazil and exceeded all commercial output in Ind..

  Determine independent variable and dependent variable

The length of the string is shortened by 5cm and the time is measured. Determine the independent variable? Determine the dependent variable? What must the controlled variables be?

  What term was a major issue during the process

What term was a major issue during the process of continuously dubbing media? Digitization cured this issue.

  Discuss your ability to generate the pareto frontier

Discuss your ability to generate the Pareto frontier in terms of the exponents you used in the compromise programming formulation. Which exponents worked satisfactorily for the complete Pareto frontier generation?

  Explain the features of microsoft word 2013

Explain the features of Microsoft Word 2013 as it applies to office productivity. Explain the features of Microsoft Word 2013 as it applies to collaboration. Explain the features of Microsoft Word 2013 as it applies to security. The paper structure n..

  Construct an e-r diagram for a car insurance company

Construct an E-R diagram for a car insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recoreded accidents.

  Determine the tax rate

1. For salaries in the range $50,000-$74,999, the controlling expression's value will be 2. for salaries in the range $75,000-$99,999, the controlling expression's value will be 3. For all other salaries, use the default case.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd