The final versions of the Shell sort and Heap sort classes. First the ShellSorter:and then the HeapSorter
By the way, I'm unemployed again. Things might be a bit quiet around here for a while.
Past (20 years or so) and present code. A variety of languages and platforms. Some gems. More gravel. Some useful stuff and some examples of how not to do it.
Showing posts with label shell sort. Show all posts
Showing posts with label shell sort. Show all posts
Thursday, October 20, 2005
Tuesday, October 11, 2005
[VScript] At last, a working shell sort
Finally found a shell sort that works. The problems I had previously might have been had because of this:
I converted that straight to VBScript and kept crashing because a[j-h] with a negative index would get evaluated. By using a do/loop and breaking the test up into two parts
... I got stuff to work. Here's the code. Usage is similar to that for heap sort.
Labels:
shell sort,
sorting,
VBScript
Tuesday, September 27, 2005
[VBScript] allsorts (not licorice)
Assorted sorts. I figured out I didn't need them after all. The BubbleSort is the slowest on large datasets.
Labels:
bubble sort,
quick sort,
shell sort,
sorting,
VBScript
Wednesday, September 07, 2005
[VBScript] Sorting agonies
After hours spent trying this algorithm and that algorithm, trying Bubble sort (too slow for my massive datasets), QuickSort (which dies from lack of stack space), and ShellSort (which runs at least), I finally stumble over something completely different: Sorting Data by Using a Disconnected Recordset.
After you read the Microsoft blurb, check out what DevGuru has to say about .Sort: PROPERTY: Recordset::Sort.
It's good, but sometimes it seems I spend ages looking for something on the 'net, implementing what I find and then stumble over what I needed in the first place when looking for something else. Aarrrgghh!
To cap the whole episode off, I find I don't need a sort at all! Access will actually protect its indexes whether I "SELECT * FROM" or whether I "SELECT TOP 1 * FROM".
"I'm a teapot, I'm a teapot ..."
After you read the Microsoft blurb, check out what DevGuru has to say about .Sort: PROPERTY: Recordset::Sort.
It's good, but sometimes it seems I spend ages looking for something on the 'net, implementing what I find and then stumble over what I needed in the first place when looking for something else. Aarrrgghh!
To cap the whole episode off, I find I don't need a sort at all! Access will actually protect its indexes whether I "SELECT * FROM" or whether I "SELECT TOP 1 * FROM".
"I'm a teapot, I'm a teapot ..."
Labels:
ADODB.RecordSet,
disconnected recordset,
shell sort,
sorting,
VBScript
Subscribe to:
Posts (Atom)