1
Answer

Recursive algorithm - datatype

Spike

Spike

14y
2.6k
1
Hi,

I am stuck with the following recursive problem:

Create a rectangular space with a given height (n) and width (m) that's divided into random rectangular rooms.
Rooms are divided by walls, a wall has a width of 1, the space between two walls is d>=1.

For example:
+++++++++++++++++++++++++++++++++
+..+....+.............+.........+
+..+....+.............+.........+
+..+....+.............+.........+
+..+....+++++++++++++++++++++++++
+..+....+...+.....+........+....+
+++++++++...+.....+........+....+
+....+..+++++++++++++++++++++++++
+....+..+......+..+......+......+
+....+..+......+..+......+......+
+++++++++++++++++++++++++++++++++

I have already tried a two dimensional array but I got stuck, so I thought of using a double arraylist but I am not quite sure, could anyone give me a helping hand?

Thanks a lot!
Answers (1)