When does quicksort work best and when does it work worst

Assignment Help Data Structure & Algorithms
Reference no: EM132200611

Question: Complete Self-Check #1 within the "Exercises for Section 8.9" subsection in Section 8.9 "Quicksort" of Ch. 8, "Sorting" in Data Structures: Abstraction and Design Using Java.

Submit your assignment to the Assignment Files tab.

Self-Check: 1. Trace the execution of quicksort on the following array, assuming that the first item in each subarray is the pivot value. Show the values of first and last for each recursive call and the array elements after returning from each call. Also, show the value of pivot during each call and the value returned through pivIndex. How many times is sort called, and how many times is partition called?55 50 10 40 80 90 60 100 70 80 20 50 22

Complete the following Review Questions within "Exercises for Sections 8.11" subsection in Section 8.11, "The Dutch National Flag" of Ch. 8, "Sorting" in Data Structures: Abstraction and Design Using Java

Submit your pseudocode response to the Assignment Files tab

• Review Question #1

• Review Question #3

• Review Question #4

1. When does quicksort work best, and when does it work worst?

2. What is the purpose of the pivot value in quicksort? How did we first select it in the text, and what is wrong with that approach for choosing a pivot value?

3. For the following array 30 40 20 15 60 80 75 4 20

show the new array after each pass of insertion sort and selection sort. How many comparisons and exchanges are performed by each?

Reference no: EM132200611

Questions Cloud

Disuss about the interviewees job responsibilities : Develop a set of questions to be asked during an in-depth interview of a professional in the field of child and/or family development.
Implement successful organization culture change : Explain the factors pertaining to organizational culture as well as the factors to implement successful organization culture change.
Legolands forecast on any particular day : What events might occur that could produce a significant error in Legolands forecast on any particular day?
How do you define power : How do you define power? What does it mean to you?
When does quicksort work best and when does it work worst : When does quicksort work best, and when does it work worst? What is the purpose of the pivot value in quicksort? How did we first select it in the text.
What are the benefits of sustainability in a company : What are the benefits of sustainability in a company? How does it teache customer loyalty and employee spirit?
Advantages and disadvantages of various revenue sources : What are advantages and disadvantages of various revenue sources as payment for services rendered in health care?
Employees successfully giving a feedback : Can you explain on how can you praise employees successfully giving a feedback?
Talk about your thoughts on product mix : Talk about your thoughts on product mix. Where should they focus their marketing dollars next year in order to increase profit margin?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Finding majority element

Let A be an array of n elements. An element x is said to be a majority element in A if it occurs in A more than n/2 times.

  Describe a linked list

Describe how a linked list can be used to implement a stack and a queue. Which method-a stack or a queue-is preferred?

  Provide the analysis and pseudo code only

Display the contents of the file GRADES created in Problem 1. Each student's record should appear on a separate line and include the total score (the sum of the three tests) for that student.

  Implement the sequential search algorithm

CS 20A: C++ Data Structures Assignment: In this assignment, you will implement three search algorithms: sequential, binary, and Fibonacci

  What is the quick sort algorithm

Which of the following would give the fastest run time when an array is sorted using the quick sort algorithm: a fully sorted array, an array of random values.

  Infinite number of optimal dynamic-priority scheduling algo

Show that there exist an infinite number of optimal dynamic-priority scheduling algorithms. (Hint: Use the fact that both EDF and LLF are optimal).

  Perform the acyclic-topological sort algorithm

Perform the acyclic-topological sort algorithm on the directed graph having vertex set a-k and edges {(j; a);(j; g);(a; b);(a; e);(b; c);(c; k);(d; e);(e; c);(e; f);(e; i);(f; k); (g; d);(g; e);(g; h);(h; e);(h; i);(i; f);(i; k)} Show the state of th..

  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.

  Estimate of the number of operations using big-o method

Give a big-O estimate of the number of operations (comparisons and additions) used by Floyd's algorithm to determine the shortest distance between every pair.

  Design greedy algorithm to solve activity selection problem

Design a greedy algorithm to solve the activity selection problem. Suppose there are a set of activities: a1, a2, ... an that wish to use a lecture hall. Each activity ai has a start time siand a finish time fi.

  Write true if the statement is true or false

It is impossible to over-train a multi-layer feed-forward network using the back-propagation learning algorithm. It is guaranteed that the longer you train your system, the more accurate it will perform.

  Discuss about a binary tree representation

Every tree and forest can be represented by a binary tree using a left-leftmost-child right next-Sibling representation;

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