I have the 2d array which is represented as following :
How can I traverse through 'one' elements only ?
any help would be appreciated :) .
Without additional metadata, you can't. You must traverse the whole array, and decide to act only when the element is a 'one'.
could you tell me what kind of metadata ?
and how can I traverse through if I have these metadata ?
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.