Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are

image text in transcribedimage text in transcribed

If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many sorting algorithms? Your mission (should you choose to accept it) is to investigate these and other questions in relation to the algorithms selection sort, insertion sort, merge sort, and quicksort. 1. Explain each of the algorithms in a way that would be understandable to an intelligent lay person. You should not use any code (or even pseudo code) in your explanation, but you will probably need to use general concepts such as "compare" and "swap", and you'll certainly need to use procedural words such as "if" and "repeat" You might find it helpful to consider an algorithm as if it were a game for which you need to define the rules. For example, here's how you could describe the bubble sort algorithm as if it was a solitaire game played with a deck of cards that contain the values to process Bubble Trouble playing area consists of several regions: foundation, tableau, stock, and discard nitially, all cards are in the stock. Play consists of a number of rounds. To begin a round, place the top card of stock face up in the tableau, then turn over the next card. If the stock card is smaller hat the tableau card, place it face down on the discard pile; otherwise, place the bleau card on the discard pile and the stock card in the tableau. Play the r stock cards in the same way, then move the final tableau card (which wl be the rgest of the stock cards) to the foundation and use the discard pile as the new stock s completes one round. ontinue to play rounds until the stock is exhausted. The cards in the foundatio will now be sorted with the smallest card on top 2. Write a set of guidelines for helping someone decide which sort algorithm would be most appropriate for a particular situation. Include in your guidelines a description of the advantages and disadvantages of each algorithm, together with an indication as to why those characteristics apply. Your goal is to provide enough information so that someone not familiar with the details of each algorithm would be able to decide which algorithm is right for them. For example, if someone was considering using counting sort, then the following brief information could help decide if it was appropriate. If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many sorting algorithms? Your mission (should you choose to accept it) is to investigate these and other questions in relation to the algorithms selection sort, insertion sort, merge sort, and quicksort. 1. Explain each of the algorithms in a way that would be understandable to an intelligent lay person. You should not use any code (or even pseudo code) in your explanation, but you will probably need to use general concepts such as "compare" and "swap", and you'll certainly need to use procedural words such as "if" and "repeat" You might find it helpful to consider an algorithm as if it were a game for which you need to define the rules. For example, here's how you could describe the bubble sort algorithm as if it was a solitaire game played with a deck of cards that contain the values to process Bubble Trouble playing area consists of several regions: foundation, tableau, stock, and discard nitially, all cards are in the stock. Play consists of a number of rounds. To begin a round, place the top card of stock face up in the tableau, then turn over the next card. If the stock card is smaller hat the tableau card, place it face down on the discard pile; otherwise, place the bleau card on the discard pile and the stock card in the tableau. Play the r stock cards in the same way, then move the final tableau card (which wl be the rgest of the stock cards) to the foundation and use the discard pile as the new stock s completes one round. ontinue to play rounds until the stock is exhausted. The cards in the foundatio will now be sorted with the smallest card on top 2. Write a set of guidelines for helping someone decide which sort algorithm would be most appropriate for a particular situation. Include in your guidelines a description of the advantages and disadvantages of each algorithm, together with an indication as to why those characteristics apply. Your goal is to provide enough information so that someone not familiar with the details of each algorithm would be able to decide which algorithm is right for them. For example, if someone was considering using counting sort, then the following brief information could help decide if it was appropriate

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago