Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Question for Alan on QuickSort

Alan -

Two questions:

1) I think I finally figured out why I'm having trouble sorting one of
my arrays using your great routine - but maybe you can confirm. Does
quicksort only work with arrays that are greater than 1D? I had an
array that was something as follows:

aRay(0) = "100000"
aRay(1) = "100100"
aRay(2) = "100200"
aRay(3) = "100250"
etc.

When I tried to used QuickSort with the following code:

QuickSort aRay, 1, LBound(aRay,1), UBound(aRay,1), True
I ended up getting a subscript out of range error on
the line:

X = SortArray((L+r)/2,col)

I'm getting ready to try creating a temporary array that will move my
array to

tempaRay(0,1) = aRay(0)
etc. in hopes that that will work...

Am I correct in my assumption?

2)

I saw in some old posts a routine called QSort by David Braden.
Do you have any knowledge of the difference from your routine and the
one included in your download in terms of speed sorting large arrays?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Question for Alan on QuickSort

Quicksort is a standard sorting algorithm which many people have implemented
in code. Whether your code only works on a 2D array would be dependent on
how the code was written. The quicksort algorithm only works on a single
column, so the most vanilla implementation would work on a 1D array
exclusively. If someone has modified it to work on 2D, then either they
made provision for both or it is exclusive to a 2D array.
looking at the declaration

Most of David Braden's code postings in this area have been built by coding
the algorithms published in Numerical Recipe's in C. As I said, quicksort
is an algorithm, so any implementation of it should be relatively the same
speed unless the person implementing it has done something goofy that would
cause it to run slower. (David's Qsort is a QuickSort algorithm).


http://groups.google.com/groups?hl=e...0%40fiastl.net

The link (to a Braden post) lists 4 implementations of sort algorithms. All
of them work only with 1D arrays.

Note that the differences in execution time are largely unnoticeable to a
user for medium size datasets.

--
Regards,
Tom Ogilvy


"Marston" wrote in message
om...
Alan -

Two questions:

1) I think I finally figured out why I'm having trouble sorting one of
my arrays using your great routine - but maybe you can confirm. Does
quicksort only work with arrays that are greater than 1D? I had an
array that was something as follows:

aRay(0) = "100000"
aRay(1) = "100100"
aRay(2) = "100200"
aRay(3) = "100250"
etc.

When I tried to used QuickSort with the following code:

QuickSort aRay, 1, LBound(aRay,1), UBound(aRay,1), True
I ended up getting a subscript out of range error on
the line:

X = SortArray((L+r)/2,col)

I'm getting ready to try creating a temporary array that will move my
array to

tempaRay(0,1) = aRay(0)
etc. in hopes that that will work...

Am I correct in my assumption?

2)

I saw in some old posts a routine called QSort by David Braden.
Do you have any knowledge of the difference from your routine and the
one included in your download in terms of speed sorting large arrays?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Question for Alan on QuickSort

First I'll get something off my chest. Last time your post was directed
specifically to me I responded first in the newsgroup, then followed up
with an email inquiry--got nothing from you. So despite my better
judgment, I'll try again.

Marston wrote:

Alan -

Two questions:

1) I think I finally figured out why I'm having trouble sorting one of
my arrays using your great routine - but maybe you can confirm. Does
quicksort only work with arrays that are greater than 1D?


The QuickSort routine included at my web site is not my routine; I don't
even remember where I got it. It works only with 1-D arrays.

I had an
array that was something as follows:

aRay(0) = "100000"
aRay(1) = "100100"
aRay(2) = "100200"
aRay(3) = "100250"
etc.

When I tried to used QuickSort with the following code:

QuickSort aRay, 1, LBound(aRay,1), UBound(aRay,1), True
I ended up getting a subscript out of range error on
the line:

X = SortArray((L+r)/2,col)


You can't have been using the QuickSort that is included on my web site
because it allows for only three arguments; you would get a Wrong number
of arguments or invalid property assignment error entering it the way
you describe above. So what's up?

I'm getting ready to try creating a temporary array that will move my
array to

tempaRay(0,1) = aRay(0)
etc. in hopes that that will work...

Am I correct in my assumption?

2)

I saw in some old posts a routine called QSort by David Braden.
Do you have any knowledge of the difference from your routine and the
one included in your download in terms of speed sorting large arrays?


In short, no. But I really don't know what distinction you're intending
between "your [i.e., my] routine" and "the one included in your [i.e.,
my] download."

Alan Beban
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Question for Alan on QuickSort

Alan - I'm very, very sorry.

I didn't get back to you immediately on the followup you posted
because I had a family distraction (my first child) and just about the
same time we changed our service providers (back to dialup from cable
that got to darn expensive).
I lost a bunch of e-mail over several days and then when we did get
hooked up again, for some odd reason, I couldn't e-mail out or post
anything. And frankly, I didn't have a lot of time to spend last week
looking at anything anyone may have sent me.

As far as the code goes, that is my total mistake. My general practice
has been to put all the code I get from different individuals into
separate modules so that its easy for me to identify not necessarily
who the creator was but whom I received the code from. I must have
erroneously put the QuickSort routine that I received in the wrong
place. Except now I don't have any knowing where I did get it from - I
did recheck the code I downloaded from you and you are absoltely
correct - so again, please except my most humble apology - you and the
others on this site have been extremely helpful to me and I totally
appreciate all the advice everyone has provided.


Alan Beban wrote in message ...
First I'll get something off my chest. Last time your post was directed
specifically to me I responded first in the newsgroup, then followed up
with an email inquiry--got nothing from you. So despite my better
judgment, I'll try again.

Marston wrote:

Alan -

Two questions:

1) I think I finally figured out why I'm having trouble sorting one of
my arrays using your great routine - but maybe you can confirm. Does
quicksort only work with arrays that are greater than 1D?


The QuickSort routine included at my web site is not my routine; I don't
even remember where I got it. It works only with 1-D arrays.

I had an
array that was something as follows:

aRay(0) = "100000"
aRay(1) = "100100"
aRay(2) = "100200"
aRay(3) = "100250"
etc.

When I tried to used QuickSort with the following code:

QuickSort aRay, 1, LBound(aRay,1), UBound(aRay,1), True
I ended up getting a subscript out of range error on
the line:

X = SortArray((L+r)/2,col)


You can't have been using the QuickSort that is included on my web site
because it allows for only three arguments; you would get a Wrong number
of arguments or invalid property assignment error entering it the way
you describe above. So what's up?

I'm getting ready to try creating a temporary array that will move my
array to

tempaRay(0,1) = aRay(0)
etc. in hopes that that will work...

Am I correct in my assumption?

2)

I saw in some old posts a routine called QSort by David Braden.
Do you have any knowledge of the difference from your routine and the
one included in your download in terms of speed sorting large arrays?


In short, no. But I really don't know what distinction you're intending
between "your [i.e., my] routine" and "the one included in your [i.e.,
my] download."

Alan Beban

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anyone used arrayfunctions from Alan Beban? SteveT Excel Worksheet Functions 3 February 26th 07 07:52 AM
VlookupS-Alan Beban Deeds Excel Worksheet Functions 4 December 20th 05 12:03 AM
Array Functions from Alan Beban Josh O. Excel Worksheet Functions 13 February 5th 05 12:54 AM
ResizeArray for Alan Question Marston Excel Programming 1 August 25th 04 07:29 PM
recursion depth, 'Out of stack space' in Quicksort marcel Excel Programming 0 April 21st 04 09:11 PM


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"