Sort the array 15 80 35 25 60 30 into descending order

Assignment Help Data Structure & Algorithms
Reference no: EM13944037

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

Reference no: EM13944037

Questions Cloud

Theoretical and methodological issues in research : Reflect critically on theoretical and methodological issues in research, including critically evaluating published journal articles;
A perfectly competitive firm has total revenue : A perfectly competitive firm has total revenue and total cost curves given by: TR = 100QTC = 5,000 + 2Q + 0.2 Q2 a. Find the profit-maximizing output for this firm.
What is the difference between terry and terri : Label the fallacy as a slippery slope, questionable cause, equivocation, etc. It's possible that you may find more than one fallacy. Please explain why you labeled the fallacy/fallacies the way you did. This will require that you briefly summarize..
Journalize the entries to record the summarized operations : Journalize the entries to record the summarized operations. For a compound transaction, if an amount box does not require an entry, leave it blank
Sort the array 15 80 35 25 60 30 into descending order : The above algorithm has a fundamental flaw. As written, how does it change theArray?
State the null hypothesis and the alternate hypothesis : The service time for customers at Stylum Barber Shop follows a normal distribution with a population standard deviation of 2 minutes. At the beginning of the fiscal year, the owner conducted a time study of 25 customers and discovered that the mea..
Calculate a regression line for data : 1. Plot the data.  Does there seem to be a linear relationship between the discount offered and sales on "Big Saturday" events? Yes or No  2. Calculate a regression line for this data (use whole numbers for the percent discount, that is, use 15 f..
What are some of challenges of becoming a critical thinker : What are some of the challenges of becoming a critical thinker in our contemporary world? In what ways do these challenges also make it important to develop critical thinking skills?
Include how unstable money can make an economy : Development of money in the economy and how it is used to create wealth. Include how unstable money can make an economy weaker.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Definiteness is one of the properties of an algorithm

Using suitable word or phrase fill up the blanks in the following sentences.

  Explain consensus algorithm

"Consensus algorithm": A group of ten people need to decide which one flavor of ice cream they will all order, out of three options.

  What are some of the critical differences

When you start a new project, what are the essential tasks you take care or start with?

  Returns true if a string contains properly nested

Give an algorithm that returns true if a string contains properly nested and balanced parentheses, and false if otherwise. Hint: At no time while scanning a legal string from left to right will you have encountered more right parentheses than left..

  Design the logic that merges the two files

Design the logic that merges the two files to produce one combined name-and-address file, which the office staff can use for addressing mailings of the practice's monthly Healthy Lifestyles newsletter

  Open addressing with double hashing where second hash funcn

Given the input {3810, 8832, 8653, 2863, 3580, 8440, 1941, 4290, 8805, 7400}

  Calculate bits number output of first round-des decryption

Calculate the bits number 1, 16, 33, and 48 at output of first round of DES decryption, suppose that ciphertext block is composed of all ones

  Prove no asynchronous t-byzantine-robust broadcast exists

Prove that no asynchronous t-Byzantine-robust broadcast algorithm exists for t=N/3. Prove that during the execution of Algorithm 14 .6 at most N(3N + 1) messages are sent by correct processes.

  Need algorithim showing a home maintenance project

Need Algorithim showing a home Maintenance Project. Problem statementHigh-level view of the program solutionFunction and internal structure of each program module

  Compute the subgame perfect nash equilibriua in given game

Compute the subgame perfect Nash equilibriua in the game below. Identify the path through the tree that each one represents, and the utilities of each player.

  Analyzing network problem

Assume you are the Systems Analyst at a producing corporation in Seattle, WA. A Systems Analyst in your company's New York office sends you a trace file to examine.

  How pseudocodes can be optimized to improve efficiency

Create an Alice World with four helicopters and a list containing the helicopters. Program the world to make the helicopters each lift off from the ground one at a time and then all turn and fly away together.

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