当前位置:天才代写 > 作业代写 > Algorithm 算法作业 CSCI:381:01代写

Algorithm 算法作业 CSCI:381:01代写

2022-09-28 09:38 星期三 所属: 作业代写 浏览:86

Algorithm 算法作业

Assignment 7

CSCI:381:01-Algorithms

Algorithm 算法作业 You need to submit Problems 1-6 as hardcopy and also submit the code for Problem 1, 3, 4, 5, and 6 to Blackboard.

Chapter 9: Medians and Order Statistics  Algorithm 算法作业

  1. Write a program to implement the algorithm RANDOMIZED_SELECT(A,p,r,i) to select the ith smallest element of the array

The output of the program should look like the following.

>>> main()

RANDOMIZED_SELECT(A,p,r,i):

Find ith smallest element of an array A for i = 3 Input: [5, 4, 3, 2, 1]

Output: 3

Algorithm 算法作业
Algorithm 算法作业

Chapter 15: Dynamic Programming

2.Exercise1-1

3.Write a program to implement the algorithm CUT_ROD(p,n) to finds the maximum revenue for a rod of n inches using recursive top-down solution.

The output of the program should look like the following.

>>> main()

Find optimal value rn

Input: [1, 5, 8, 9, 10, 17, 17, 20]

Output: 22

4.Write a program to implement the algorithm MEMOIZED_CUT_ROD(p,n) to finds the maximum revenue for a rod of n inches using top-down with memoization.

The output of the program should look like the following.  Algorithm 算法作业

>>> main()

Find optimal value rn

Input: [1, 5, 8, 9, 10, 17, 17, 20]

Output: 22

5.Write a program to implement the algorithm BOTTOM_UP_CUT_ROD(p,n) to finds the maximum revenue for a rod of n inches using bottom-up solution.

The output of the program should look like the following.

>>> main()

Find optimal value rn

Input: [1, 5, 8, 9, 10, 17, 17, 20]

Output: 22

6.Write a program to implement the algorithm PRINT_CUT_ROD_SOLUTION(p,n) to print the cuts using theEXTENDED_BOTTOM_UP_CUT_ROD(p,n).  Algorithm 算法作业

The output of the program should look like the following.

>>> main()

Find optimal value rn

Input: [1, 5, 8, 9, 10, 17, 17, 20]

2

6

You need to submit Problems 1-6 as hardcopy and also submit the code for Problem 1, 3, 4, 5, and 6 to Blackboard.


Guideline for Homework Submission  Algorithm 算法作业

  1. Zip the files of the programs and submit the zipped file to
  2. The first three lines in each file are

a)Write the name of the program on the first line.

b)Describe the purpose of the program on the second line.

c)Write the name of the programmer on the third line.

For example,

// Filename: assignment1.py

// Purpose: This program coverts a positive integer in base 10 to a new base.

// Programmer: R2 D2

Algorithm 算法作业
Algorithm 算法作业

 

更多代写:加拿大MATH数学代写  雅思线上考试  加拿大代写推荐  经济学网课托管推荐  留学生统计代写  枪手代考

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式