Hi guys
I need help on an example of a fast structure sorting algoritm
The goal is sort a array of structure based on the contents of one of it´s members.
The structure is on this syntax[DFMScript:
DFMScript.pLabelName: D$ Label1
DFMScript.pSigLabel: D$ SigLabel1
DFMScript.pExtention: D$ ExtLabel1
DFMScript.pSignatureData: D$ SigData1
DFMScript.pSigSize: D$ 16]
[Label1: B$ "Trilobyte's JPEG graphics Library", 0]
[SigLabel1: "Sample Name", 0]
[ExtLabel1: B$ "jpg", 0]
[SigData1: B$ 084 010 0F1 0F2 0F3 0F4 01E 00 01 010 08 09 07 06 05 04]
When i have an array of n structures they need to be sorted biased on the SigSize and also on pSignatureData. So, the 1st array of the structure must be the value with bigger size. Ex:
Unsorted
[DFMScript:
DFMScript.pLabelName: D$ Label2
DFMScript.pSigLabel: D$ SigLabel2
DFMScript.pExtention: D$ ExtLabel2
DFMScript.pSignatureData: D$ SigData2
DFMScript.pSigSize: D$ 10]
[DFMScript:
DFMScript.pLabelName: D$ Label1
DFMScript.pSigLabel: D$ SigLabel1
DFMScript.pExtention: D$ ExtLabel1
DFMScript.pSignatureData: D$ SigData1
DFMScript.pSigSize: D$ 16]
[Label1: B$ "Trilobyte's JPEG graphics Library", 0]
[SigLabel1: "Sample Name", 0]
[ExtLabel1: B$ "jpg", 0]
[SigData1: B$ 084 010 0F1 0F2 0F3 0F4 01E 00 01 010 08 09 07 06 05 04]
[Label2: B$ "Trilobyte's JPEG graphics Library 2", 0]
[SigLabel2: "Sample Name 2", 0]
[ExtLabel2: B$ "jpg", 0]
[SigData2: B$ 084 010 0F1 0F2 0F3 0F0 09 00 01 010]
Sorted
Unsorted
[DFMScript:
DFMScript.pLabelName: D$ Label1
DFMScript.pSigLabel: D$ SigLabel1
DFMScript.pExtention: D$ ExtLabel1
DFMScript.pSignatureData: D$ SigData1
DFMScript.pSigSize: D$ 16]
[DFMScript:
DFMScript.pLabelName: D$ Label2
DFMScript.pSigLabel: D$ SigLabel2
DFMScript.pExtention: D$ ExtLabel2
DFMScript.pSignatureData: D$ SigData2
DFMScript.pSigSize: D$ 10]
[Label1: B$ "Trilobyte's JPEG graphics Library", 0]
[SigLabel1: "Sample Name", 0]
[ExtLabel1: B$ "jpg", 0]
[SigData1: B$ 084 010 0F1 0F2 0F3 0F4 01E 00 01 010 08 09 07 06 05 04]
[Label2: B$ "Trilobyte's JPEG graphics Library 2", 0]
[SigLabel2: "Sample Name 2", 0]
[ExtLabel2: B$ "jpg", 0]
[SigData2: B$ 084 010 0F1 0F2 0F3 0F0 09 00 01 010]
Btw...what needs to be sorted is the structure members and not necessarily their pointers.