Question

Is it possible to solve this without iterating over the array?

Suppose I have an array having 4 slots, [] [] [] []

and I know 2 points [x] [x] [] [] , is it possible to have a formula that tells us the coordinates of the other two empty spots? (using a mathematical formula, (not if this then that or iterate and fin the empty spots)) I think in most cases we get lazy and instead of trying to find a real solution to problems we tend to do it the easy way, by using conditions and iterations :/

Was it helpful?

Solution

No your not given enough information. You don't know what the other two points should be. All you can tell with A[x1][x2][][] is that the last two coordinated lie on a subset that is intersected be x1 and x2

Example Let Word be an array that give us a representation of a word in a book

Word [page][line][number of words into line]

Now if I only gave you the page of the book and the line in the page there's no way you can tell me the word you need more information

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top