Menu

(Solved) : 1 Let G X N Map Square Tiles Let K Number Ferent Programs Take Possible Tile Colors Consid Q31337178 . . .

1 Let G be an x n map of square tiles, and let k be the number of ferent programs that take in possible tile colors. We will consider dif the maps dimensions and number of colors and generate a graph G that represents a random iling. You can use either an adjacency list or adjacency matrix representation (a) (10 pts) Write pseudocode for a program called RANDOM-MAP-UNIFORM(n, k) where every tile has 1/k proba- bility of being of any particular color. Make sure to comment your pseudocode, so that it is easier to follow its logi. (b) (20 pts) Write pseudocode for a program called RANDOM-MAP-DIsJOINT(n, k) that colors the graph from top to bottom and left to right. Every tile has 1/k probability of be- ing of any particular color but no two neighboring tiles can have the same color. When your program t first randomly picks a colori s k. If i is the same as one of its neighbors, the program stops; ot herwise it continues ries to color a new tile, it (c) (5 pts) Do a worst-case analysis of RANDOM-MAP-DISJOINT (d) (10 pts) Do a probabilistic analysis of RANDOM-MAP-DIsJOINT On average, how many tiles do color as a function of n and k?1 Let G be an x n map of square tiles, and let k be the number of ferent programs that take in possible tile colors. We will consider dif the map’s dimensions and number of colors and generate a graph G that represents a random iling. You can use either an adjacency list or adjacency matrix representation (a) (10 pts) Write pseudocode for a program called RANDOM-MAP-UNIFORM(n, k) where every tile has 1/k proba- bility of being of any particular color. Make sure to comment your pseudocode, so that it is easier to follow its logi. (b) (20 pts) Write pseudocode for a program called RANDOM-MAP-DIsJOINT(n, k) that colors the graph from top to bottom and left to right. Every tile has 1/k probability of be- ing of any particular color but no two neighboring tiles can have the same color. When your program t first randomly picks a colori s k. If i is the same as one of its neighbors, the program stops; ot herwise it continues ries to color a new tile, it (c) (5 pts) Do a worst-case analysis of RANDOM-MAP-DISJOINT (d) (10 pts) Do a probabilistic analysis of RANDOM-MAP-DIsJOINT On average, how many tiles do color as a function of n and k? Show transcribed image text

Expert Answer


Answer to 1 Let G X N Map Square Tiles Let K Number Ferent Programs Take Possible Tile Colors Consid Q31337178 . . .

OR