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

  Describe the need for complex data structures

Describe the need for complex data structures and how they are used. Describe the design and application of arrays and how the array simplifies program development.

  A local company owns three 3d printers

A local company owns three 3D printers installed in its three different branches. Clients can call the company and reserve the use of one printer for some hours.

  Explain rijndael algorithm in some detail to your classmates

The Rijndael algorithm was chosen for the Advanced Encryption Standard (AES). Pick one (or more) steps of the algorithm and explain it in some detail to your classmates.

  Model of online music sharing

Since Napster is going out of business, you have decided to begin your own on line music sharing site. You will give individual music documents at your site.

  Stack evaluating the postfix expression

Step will use the queue (PostQueue) that was the result of the infix to postfix conversion, and a stack -  A stack Evaluating the postfix expression

  Explain spacewise efficient implementation two-stack data

Structure of such two-stack data type would consist of two arrays and two top pointers. Describe why this may not be a spacewise efficient implementation.

  Design pseudo code for a program that accepts insurance data

Design a flowchart or pseudo code for the A program that accepts insurance policy data, including a policy number, customer last name, customer first name, age, premium due date (month, day, and year), and number of driver accidents in the last thr..

  Analyze the worst-case runtime of the new merge sort

Analyze the worst-case runtime of the new merge sort and compare the complexity of the original merge sort with the complexity of the new merge sort.

  Conduct time complexity analysis of the algorithm

Conduct time complexity analysis of the algorithm and hand test your algorithm using your allocated 10-element long list of alphabetic characters as an illustrative/working example

  Build b tree for the part table

Build B+ tree for the PART table with n = 6 pointers; illustrate how B+ tree expand (show several intermediate trees) and what final tree will look like.

  Draw a structured flowchart or write pseudocode

Draw a structured flowchart or write pseudocode that describes the process of looking up a word in a dictionary. Pick a word at random and have a fellow student attempt to carry out your instructions.

  How to write a story into an array

Find a popular children's story and store it into an array. Prompt a user to search for a string within the array, returning the position of the search item within the array.

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