当前栏目: python
查看分类

python代写-NOTE: Most of your time should be spend on question 2!

 

1. (2 point) Consider function1 and function2 defined in hw7functions.py.

What is the Big-O running time bound (i.e. is it O(n), O(n log n), O(n*n), ...?) for function1?

What are the worst-case and best-case Big-O running time bounds for function2?

2. (5 points) Carefully compare several sorting methods and produce a document discussing your results. You will be graded on the quality of your test data, the effectiveness of your charts/graphs, and your written discussion of the results.

 

Start with the code in hw7sorts.py. The file includes three sorting methods: selection, insertion, merge, and builtin (Python's built-in sort).

 

For this problem, you must add two additional sorting functions to the file and compare the running times of all of the sorting functions on a variety of data. Make sure you use large enough and varied enough data!

 

One of the sorting functions you must add is quicksort. The other can be any other method you find (except bubble sort). You may search the Internet (or books) for Python implementations to use. Be careful with quicksorts found on the web! It's easy to find "bad" ones - use knowledge of quicksort from lecture 31 to find a good one.

 

The write-up will likely be several pages. It should (a) describe how you generated test data (2) include graphs, charts, and/or tables of your timing results (these must be images of things generated by Python - no hand-made graphs/charts/tables!), and (c) discuss conclusions about the relative performance of the various sorts. This should include, where appropriate, assessment of best/average/worst base behavior, and of how performance data fits with what we know about the Big-O running time bounds of these methods.

 

For this assignment, submit two things:

one Python file containing everything in the original hw7sorts.py plus what you added, including code you used to generate your test data, timing results, and graphs/charts.

a pdf document containing written answers to Q1, Q2, and Q3. NOTE: .doc,.rtf, and similar documents are not acceptable! Convert to pdf before submitting (via "Save As" or similar means)

 

(以上发布均为题目,为保证客户隐私,源代码绝不外泄!!)