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

  Greedy strategy for finding a shortest path

Think about the given greedy strategy for finding a shortest path from vertex start to vertex goal in a connected graph.

  Show the evolution of the line in the first 10 minutes

Assume you are at the airport, waiting for security check.  There is one line(which is a FIFO queue), and 5 security check gates.  Each person reaching the front of the queue is checked by the first available security gate.

  Show that there exists an election algorithm for hypercubes

Show that there exists an 0 (N log N) election algorithm for hypercubes without a sense of direction. Show that there exists an O(N(log N +k)) election algorithm for networks with bounded degree k

  Design a flow chart to provide a visual representation

Design a flow chart to provide a visual representation of the interconnections between the histories of ECEC and how it has evolved to current pedagogy and practice

  Create a loop structure to display all integer values

Determine if the first number is larger than, smaller than, or equal to the second number.

  High bandwidth network for the multimedia team

Assume you have been assigned to build a network for a multimedia development company that currently uses a 10-Mbps Ethernet network. The corporation requires a high bandwidth network for multimedia team.

  Time sharing operating system

Assume a time sharing operating system allocated time slices of twenty milliseconds and the machine executed an average of 5000 instructions per microsecond.

  Design an algorithm to sort the elements using merge sort

What are preorder, Inorder, postorder traversals of a binary tree? Design recursion algorithms to implement them and explain with the help of an example.

  Explain method for combining two trees-heap-order property

Assume two binary trees, T 1 and T 2 , hold entries satisfying heap-order property. Explain method for combining T 1 and T 2 into a tree T whose internal nodes hold union of entries

  How two types of assets are valued for balance sheet purpose

Explain how the 2-types of assets are valued for balance sheet purposes, using the following assets owned by a corporation that writes and sells software packages

  Height information in an avl tree

Design a linear-time algorithm that verifies that the height information in an AVL tree is correctly maintained and that the balance property is in order.

  What is the time complexity of your algorithm

You may describe your algorithm using pseudo-code, but you must describe youralgorithm in English. What is the time complexity of your algorithm?

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