Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 15th, 2011, 05:40 AM
Authorized User
 
Join Date: Feb 2011
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chapter 12 quickSort confusion

Good morning,
[edit] ive been stepping through the quickSort code and although i dont find it intuitive (seems to be a little over my head) i was wondering whether the following would have been considerably slower?

1) find minimum value in array and swap with element 0 in array.
2)re-scan array from element 1->array.Length and swap element 1 for the smallest element found.
3)repeat step 2 for remaining array elements, ie 2 onwards.

Thanks for your time

Last edited by scolty; May 15th, 2011 at 08:52 AM.
Reply With Quote
  #2 (permalink)  
Old May 17th, 2011, 04:16 PM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Sorting

The method you're describing is close to a simple Bubble Sort. There are any number of sorting algorithms and the Bubble Sort is about the easiest to understand. However, in most cases, it is also the slowest. (If the list is already in sorted order and you insert 1 new value, the Bubble Sort can be the fastest sort.) If you want to understand how qsort (or almost any other sort works), you can Google it and find a number of explanations with samples (http://www.inf.fhflensburg.de/lang/a...ck/quicken.htm)
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
Reply With Quote
  #3 (permalink)  
Old May 17th, 2011, 04:52 PM
Authorized User
 
Join Date: Feb 2011
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Evening, thanks for taking the time to reply. I initially had some issues getting my head around the quicksort code and although i roughly understand how it works, its still doesnt feel intuitive. Thanks for the link though + hopefully that will allow me to get a decent nights sleep tonight.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 12 QuickSort too much calls to doSort()? comecme BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 1 November 30th, 2010 02:56 PM
Chapter 3, Exercise 5 confusion Calion BOOK Beginning Lua Programming ISBN: 978-0-470-06917-2 0 November 17th, 2010 12:14 AM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Array Intializting problem in QuickSort shah123 C# 3 March 27th, 2007 09:18 AM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM



All times are GMT -4. The time now is 05:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.