every element in 3D array can be written in the form of *(*(*(a+i)+j)+k) = a[i][j][k] ele = required element to be searched for say M = number of 3D matrices R = number of row C = number of col
First find the most probable matrix in which the element might be present fix j = R-1 fix k = C-1 //as index starts from 0 max = *(*(*(a+i)+j)+k) //which is a[i][R-1][C-1] min = ***(a+i) //which is a[i][0][0] where is varies from 0 to M-1 now if ele >=min && ele <= max then index = i; //index = required matrix number Now search as u shall search in 2D matrix keeping i constant and varying j and k -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Bo3X7D2XPPQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.