Thinking of a parking lot it can be divided in to following hierarchy.
Structure
Level1 Level2 Level3
Row1 Row2 Row3 Row1 Row2 Row3 Row1 Row2 Row3
1...N 1...N 1...N 1...N N....N 1....N 1.....N 1....N 1.....N
Here bottom most level is 1 to N spots available in a row. It resembles very much like a tree data structure where each node can hold a value true if one of its subtree has a space available or false if all are occupied. And then next row or in case of a level, next level is examined. Now I have following questions:
- Is there a tree data structure which can have different number of child nodes at different level E.g it is 3 for level 2 and N for level 3.
- If such a tree is possible what will be its time complexity ?
- If such a tree is not possible what data structure can be used to represent this hierarchy.