multi dim sorting problem

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

multi dim sorting problem

Post by HaWe »

hi,
I have a sorting problem to be resolved by highest possible speed.

I have BLOBS provided by a struc
struc {
int x
int y
int heigth
int width
char colorID} tblob;
and I have a various number of random

tblob blob[];

the max number of blobs is 1000 but actually it will probably not exceed 50.
colorID is sth between 0 and 15.


I get the blob data by a serial connection randomly, unsorted.

I want to sort by
1.) colorID
2.) size which is (width * heigth)

I want to access the blob data by searching for the coordinates by
blobcoordinates(colorID, sizeorder, &x, &y), e.g.

blobcoordinates(2, 3, &x, &y, &width, &height) will return by reference the x,y coordinates plus sizes of the 3rd largest object of colorID=2.

what do you think would be the quickest coding ?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest