Hello!

I am trying to implement search algorithms in a 2D grid.
The problem I am facing is that let's say that I make a 2D grid in c++ through some array and also block some cells. Now how will I convert this grid into a binary tree to run search algorithm on it?
Any formula is applicable?

Why convert to binary tree? Is it even possible to convert from NxM grid to binary tree and keep the semantics of your 'grid'?