944,087 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2279
  • C RSS
Feb 21st, 2006
0

quick sort question

Expand Post »
Below is my assignment. If I understand this correctly pivot as a median is the middle of the highest, middle, and lowest numbers. In this case 35 (14, 35, 72). Please correct me if I am wrong. I do not understand how to do part b. Could someone please explain this as well? Thank you in advance.

assume the following list of keys

18, 40, 16, 82, 64, 67, 57, 50, 37, 47, 72, 14, 17, 27, 35

This list is to be sorted using the quick sort algorithm. Use pivot as the median of the first, last and middle elements of the list.

a. what is pivot?
b. give the resulting list after one call to the partition procedure.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
btech is offline Offline
38 posts
since Oct 2005
Feb 21st, 2006
0

Re: quick sort question

>a. what is pivot?
A pivot is the one item that will be in sorted position after you partition the list.

>b. give the resulting list after one call to the partition procedure.
This depends on the partitioning algorithm.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: syntax error
Next Thread in C Forum Timeline: Class Functions and Conversions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC