Re: fastest way to change case of string



I have Quicksort-Code wich works on onedimensional StringArrays,
using the same approach, swapping only the BSTR-Pointers.

I am interested in that. Could you post it here?

I would recommend either alternatives to the 2D-Array (e.g. Recordsets,
wich can be sorted in a comfortable way)

Had a look at that, but couldn't find a fast way to write the array to a Recordset.
All I could see was a simple (nested) loop.

or a separate Index-Array (of Type Long), wich acts as an additional layer of indirection

Not an option in my case. I need the actual arrays to be sorted.
What I can do though (and have done) is make a separate index array, sort that and then move
the rows of the original array according to the index array. The more columns the more this
will pay off as there will be less data to be swapped.

RBS


"Schmidt" <sss@xxxxxxxxx> wrote in message news:uS8vp8PgGHA.4932@xxxxxxxxxxxxxxxxxxxxxxx

"RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:OSgaz5LgGHA.3652@xxxxxxxxxxxxxxxxxxxxxxx

Looking at this code it seems it a similar approach could be used to sort
a variant 2-D array. The underlying quicksort would be the same, but it
would be
the data swapping bit that should be different.
The arrays I am particularly interested in are arrays where I want to sort
on a column holding Long numbers with the other columns holding
strings, non-integer and integer numbers.
This is mentioned in Matthew Curland's book, but I think it needs a helper
file that is on the CD, which I don't have.
Also, the example is for 1-D arrays and not 2-D arrays.
Would you by any chance have code already that does this?
I have Quicksort-Code wich works on onedimensional StringArrays,
using the same approach, swapping only the BSTR-Pointers.

But if you have a 2D-Array, a single Row takes
ColumnCount*LenB(ArrayType) Bytes.
There are no "RowPointers" in such a scenario, wich could be swapped
efficiently, transfering only the 4 "Pointer-Bytes" - so the Array-Span-
Approach makes no sense for such an array.
I would recommend either alternatives to the 2D-Array (e.g. Recordsets,
wich can be sorted in a comfortable way) or a separate Index-Array
(of Type Long), wich acts as an additional layer of indirection.
In your Quicksort you would then compare using this Index-Array.
Actually you have something like this
If Arr2D(RowIdx, CompareIdx) < ...
For indirect sorting you're not allowed. to access the RowIdx
directly inside the compares- instead you will have to write:
If Arr2D(IdxArr(RowIdx), CompareIdx) < ...
But this way you are able, to swap only the Entries in the IndexArray,
and so you achieve a better "over-all-sort-performance".
Of course, access to the "sorted" original 2D-Array (wich remains
untouched) is then only possible, using the indirection over
IdxArr(RowIdx), instead of using the RowIdx directly.

Olaf



.



Relevant Pages

  • Re: Is there a faster hi resolution timer for diy profiling
    ... in the build options theres optimise code wich makes a slight difference. ... I had to ask how to do 1 or 2 things so far only to be told you cant do ... wich is an array of structs, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Super slow table array formulas
    ... Wich is the table array. ... sheet one, but the range is literally r4:s12. ... "Don Guillett" wrote: ...
    (microsoft.public.excel.worksheet.functions)
  • fastest sorted list type?
    ... I wish to make a sorted index array based on the length, ... wich does have duplicates. ... using a comparar wich took the index and looked up struct in the array and ... structs as a list of classes would require lots of allocations ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Multidimensional Packed Bit Array
    ... so if you want to map a 3 dim array into a single dim array ... wich is fairly easy but can be explained if needed. ... just dont get it *as always* ...
    (microsoft.public.dotnet.languages.csharp)
  • assinging strings to two dimensional array
    ... array in wich I store the names of the players. ... cin.get I ask the names of the players and everything works fine. ... set the second element of the two-dimensional array to computer. ... In the second I want to store the name computer. ...
    (comp.lang.cpp)