flat assembler
Message board for the users of flat assembler.
Index
> Main > Count number of distinct colors in a buffer |
Author |
|
macomics 27 May 2022, 15:00
Copy all the colors from the Bitmap into a linear array, sort it and count the number of colors that do not match the previous one in the array.
You can not copy if bitmap is not a pity. Last edited by macomics on 27 May 2022, 15:01; edited 1 time in total |
|||
27 May 2022, 15:00 |
|
revolution 27 May 2022, 15:01
I think a simple sort would work better than building a buffer one by one.
Your algorithm is O(N^2). A sort would be O(N log N). |
|||
27 May 2022, 15:01 |
|
macomics 27 May 2022, 15:08
revolution wrote: Your algorithm is O(N^2). A sort would be O(N log N). |
|||
27 May 2022, 15:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.