{ { { { { { { { { { { { { { { { { { { { { { { { { figure initial stateall walls upall cells in their own set containing and are combined via union operation this is because everything that was connected to is now connected to everything that was connected to at the end of the algorithmdepicted in figure everything is connectedand we are done the running time of the algorithm is dominated by the union/find costs the size of the union/find universe is equal to the number of cells the number of find operations is proportional to the number of cellssince the number of removed walls is one less than the number of cellswhile with carewe see that there are only about twice the number of walls as cells in the first place thusif is the number of cellssince there are two finds per randomly targeted wallthis gives an estimate of between (roughly and find operations throughout the algorithm thereforethe algorithm' running time can be taken as ( logn)and this algorithm quickly generates maze { { { { { { { { { { { { { figure at some point in the algorithmseveral walls downsets have mergedif at this point the wall between and is randomly selectedthis wall is not knocked downbecause and are already connected