Checkout
checkout
view
Your Cart Your Cart: item(s)
Add to Shopping Cart
$2.19 Instant Download
Computer Science, Data Structures and Algorithms
Year 1

A problem about Sorting in Java


Part (A) Sort the array 15 80 35 25 60 30 into  descending order using

a)     the selection sort.
b)     the buble sort.

Part (B) A first year student attempted to write mergesort in pseudocode as follows.



mergesort(theArray, n) {

  if (n > 1){ // more than one item to sort

       mergesort(left half of theArray, n/2)

       mergesort(right half of theArray, n/2)

  }

}



a)   The above algorithm has a fundamental flaw. As written, how does it change theArray?

b)   What is the worst-case runtime of this incorrect algorithm? Give as tight an asymptotic upper bound as possible, using Big-Oh notation as a function of n. Justify your answer.


The original course website where the problem comes from is here, I think it will be helpful if you take a look at it first: www.student.math.uwaterloo.ca/~cs134

By OTA:  Huanhuan Liang, MSc

OTA Rating:  4.8/5

Your Price:  $2.19  (original value ~$15.96)

What's included:

  • Plain text response
  • Attachment(s):
    • answer1.doc
$2.19 Download Add to Cart

Add to Shopping Cart
$2.19 Instant Download

Page generated in 0.0125 seconds

About Us ·  Contact Us ·  Samples ·  Solutions ·  Legal Terms and Conditions ·  Privacy Policy

©2008 SolutionLibrary.com

Search for Solutions About Us Samples