What kind of sort you would use for a given situation

Assignment Help Data Structure & Algorithms
Reference no: EM131442626

Algorithm Development Discussion

Part 1: Sorting Methods

Sorts are used every day in many applications.

• Discuss when you would use a sort and what kind of sort you would use for a given situation.
• Reply to others with support for or arguments against their proposal of sort usage and implementation.

Part 2: Respond to two peer posts

Peer 1 David

There are several types of sorting algorithms. I have used many of them over the years. A good example is to think about a binary search. For a binary search to work the array or list must be sorted. If you are given an unsorted list or if you are not sure if the list is sorted or not, a sorting algorithm is needed. Which sorting algorithm to use in this situation is mainly up to you. You should use a merge sort or insertion sort because of their speed but a bubble sort or selection sort still work. Bubble sort is one of the slowest sorting algorithms but it is the easiest one to code. It can be done with two for loops whereas the other sorting algorithms are more complex but are faster.

Peer 2 Toni

Quick sort: would be used when you don't need a stable sort and average case performance matters more than worst case performance. A quick sort is O(N log N) on average, O(N^2) in the worst case.

Merge sort: is used when you need a stable, O(N log N) sort, this is about your only option. The only downsides to it are that it uses O(N) auxiliary space and has a slightly larger constant than a quick sort.

Heap sort: is used when you don't need a stable sort and you care more about worst case performance than average case performance. It's guaranteed to be O(N log N), and uses O(1) auxiliary space.

Introsort: This is a quick sort that switches to a heap sort after a certain recursion depth to get around quick sort's O(N^2) worst case. It's almost always better than a plain old quick sort.

Insertion sort: When N is guaranteed to be small, including as the base case of a quick sort or merge sort. While this is O(N^2), it has a very small constant and is a stable sort.

Bubble sort, selection sort: When you're doing something quick and dirty and for some reason you can't just use the standard library's sorting algorithm.

Reference no: EM131442626

Questions Cloud

Middle-age men currently employed by the corporation : The fat percentages found were as follows: 24, 40, 29, 32, 33, 25, 15, 22, 18, 25, 16, 27. On the basis of these data, can we conclude that middle-age men employed by the corporation have become fatter? Assume a directional H1 is legitimate and us..
How are patterns applied to design the framework : What is a persistence framework, and how are patterns applied to design the framework? What are the benefits of applying the patterns?
Develop your revised companys mission statement : you will conduct a SWOT (Strength, Weakness, Opportunity, and Threat) analysis for the type of beverage you have selected, and for your company overall. As you work on the assignment, consider why you have chosen one type of non-alcoholic beverage..
What is the change of revenue generated by sale : What's the change of revenue generated by sale when the price elasticity of demand falls from infinite to 1? Explain how we can account for ‘bads' (such as pollution) in analysis of consumer preferences.
What kind of sort you would use for a given situation : Discuss when you would use a sort and what kind of sort you would use for a given situation. Reply to others with support for or arguments against their proposal of sort usage and implementation.
What is the test statistic for sample : The contractor took 27 water samples and found an average pH of 6.3 with a sample standard deviation of 1.86. What is the test statistic for this sample?
American association of building contractors : A report issued by the American Association of Building Contractors indicates that 40% of all home buyers will do some remodeling to their home within the first 5 years of home ownership. Assuming this is true, use the binomial distribution table ..
Draw a use case model for the information system : Draw a use case model for the information system. Write brief Use Case description for each Use Case in the diagram. Write one fully developed Use Case description for one of the important Use Cases identified.
Implement the mergetwosortedseries function : Implement the mergeTwoSortedSeries function. Given a series of sizeOfA sorted values starting at the memory location pointed to by ptrA and a series of sizeOfB sorted values starting at the memory location pointed to by ptrB

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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