Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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..
 
Old May 17th, 2011, 04:16 PM
Friend of Wrox
 
Join Date: Sep 2008
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)
 
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.





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 03:56 PM
Chapter 3, Exercise 5 confusion Calion BOOK Beginning Lua Programming ISBN: 978-0-470-06917-2 0 November 17th, 2010 01: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.