2d Array

Dec 2, 2013 at 11:57pm
Hello ,
I have the 2d array which is represented as following :

1000000000
1100000000
0111100000
0000111111

How can I traverse through 'one' elements only ?
any help would be appreciated :) .
Dec 3, 2013 at 1:02am
Without additional metadata, you can't. You must traverse the whole array, and decide to act only when the element is a 'one'.
Dec 3, 2013 at 1:22am
could you tell me what kind of metadata ?
and how can I traverse through if I have these metadata ?
Thanks :).
Dec 3, 2013 at 2:23am
Like pointers to the next 'one'. For such a small array, you are wasting your time. Just iterate through the whole thing and only take action when the value is 1.
Topic archived. No new replies allowed.