Question

Big O run time of algorithm

image.png

Figure 1: An 8 x & Mario world and corresponding Mario graph. 2 Super Mario Run A Mario world M consists of a k xk gid. Each field in the grid is either empy or brick. Two empty fields are marked as start and goal (see Fig. 21a). The goal ot the game s to move the playe, called Mario, irom the start field to the goal field. When Mario is in field (x,y) he has the following options: Forward Mario moves to the hiekd (r +1,y). This move is possible if (x+ 1,y) is empty and (x + 1,y-1) s brick. Jump Mario moves to the field (r+1,y+2). This move is possible if the fields (x,y + 2), (r, y + 1), and (x +1,y+ 2) e emp % ana (x *1,y*1)15 brick. Fall Mario moves to the field (r +1,y) where y < y is the maximal value y' such that (x + 1, y'-1) is brick and x+ 1, y), (x+1,y-1),.., (x+ 1,y) are empty: For instance, Mario in field (4, 4) can move fonward to (5,4) or jump to field (5, 6). Amove is alid if the move can be done according to the above rules. All tields that can be reached via valid moves from the start field are the valid fields. For example, (4, 4) isa valid field, sinoe it can be reached from the start field in (1,2) doing the sequence of valid movesz forward, torward, jump. A Mario world M defines a directed graph G with n vertices and m edges (see Fig. 2(b)). All valid fields correspond vertex and the valid moves define the edges (there is an edge from field (r, y) to fie ld r,y)it Mario can move trom (x, y) to (x', y') with a valid move). The edges oorrespondin g to torward, junp and tall are denoted by forward edges, jump edges and fall edges. 2.1 Let M be a Mario world defined on a k xk grid and let G be the corresponding Mario graph. Indicate the maximum TALIImber ot nodes n that can appear an G as a function of k. Solution: ae(log k) De(vk) e(k) oeklogk) Detk) De(z) 2.2 Let M be a Mario worlid defined on a k Xxk grid and let G be the corresponding Mario graph. Indicate the maximum number of edges m that can appear in G as a function of k. Solution: e(log k) evk) ek) eklogk) 0ek) De(z
1 0
Add a comment Improve this question Transcribed image text
Answer #1

2.1- the answer is 6. i.e. o(2^k)

2.2- the answer is the first option i.e. o(log k)

Add a comment
Know the answer?
Add Answer to:
Big O run time of algorithm
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2 Super Mario Run A Mario world M consists of a k × k grid. Each field in the grid is either empt...

    Big O run time of algorithm 2 Super Mario Run A Mario world M consists of a k × k grid. Each field in the grid is either empty or brick. Two empty fields are marked as start and goal (see Fig. 2(a)). The goal of the game is to move the player, called Mario, from the start field to the goal field. When Mario is in field (x, y) he has the following options Forward Mario moves to the...

  • 2 Super Mario Run A Mario World M consists of a k xk grid. Each field...

    2 Super Mario Run A Mario World M consists of a k xk grid. Each field in the grid is either empty or brick. Two empty fields are marked as start and goal (see Fig. 2(a)). The goal of the game is to move the player, called Mario, from the start field to the goal field. When Mario is in field (x,y) he has the following options: Forward Mario moves to the field (x + 1,y). This move is possible...

  • 2 Super Mario Run A Mario World M consists of a k xk grid. Each field...

    2 Super Mario Run A Mario World M consists of a k xk grid. Each field in the grid is either empty or brick. Two empty fields are marked as start and goal (see Fig. 2(a)). The goal of the game is to move the player, called Mario, from the start field to the goal field. When Mario is in field (x,y) he has the following options: Forward Mario moves to the field (x+1, y). This move is possible if...

  • a derived class from Organism. You must complete the constructors, and the method definitions that were...

    a derived class from Organism. You must complete the constructors, and the method definitions that were abstract methods in Organism. /** Organism.java * Definition for the Organism base class. * Each organism has a reference back to the World object so it can move * itself about in the world. */ public abstract class Organism {    protected int x, y;       // Position in the world    protected boolean moved;   // boolean to indicate if moved this turn   ...

  • I need help with my programming assignment. The language used should be java and the algorithm...

    I need help with my programming assignment. The language used should be java and the algorithm should use search trees so that you play against the computer and he chooses the best move. The tree should have all possibilities on the leaves and you could use recursion to so that it populates itself. The game can be a 3*3 board (no need the make it n*n). Please put comments so that I can understand it. Thanks The game of ‘Walls’...

  • This is my code for my game called Reversi, I need to you to make the...

    This is my code for my game called Reversi, I need to you to make the Tester program that will run and complete the game. Below is my code, please add comments and Javadoc. Thank you. public class Cell { // Displays 'B' for the black disk player. public static final char BLACK = 'B'; // Displays 'W' for the white disk player. public static final char WHITE = 'W'; // Displays '*' for the possible moves available. public static...

  • (1) Length of graphs a) Let a path C be given by the graph of y g(x), a 3 < b, with a piecewise C...

    Please solve these three questions! (1) Length of graphs a) Let a path C be given by the graph of y g(x), a 3 < b, with a piecewise C1 function g : [a, b - IR. Show that the path integral of a continuous function f: IR2- R over the path C is b) Let g : [a, b] - IR be a piecewise C1 function. The length of the graph of g on (t, g(t)). Show that [a,b]...

  • er (a) Let G be a connected graph and C a non-trivial circuit in G. Prove...

    er (a) Let G be a connected graph and C a non-trivial circuit in G. Prove directly that if an edge ={a, b} is removed from then the subgraph S CG that remains is still connected. Directly' means using only the definitions of the concepts involved, in this case 'connected' and 'circuit'. Hint: If r and y are vertices of G connected by path that includes e, is there an alternative path connecting x to y that avoids e? (b)...

  • could you provide a detailed solution for this question. Like and comment are rewarded, thanks 2....

    could you provide a detailed solution for this question. Like and comment are rewarded, thanks 2. Consider the system shown in the figure below. y m1 k,1 Mass mi moves horizontally along the x axis and its position is given by coordinate x1. It is attached to mass m2 by a light spring of spring constant k and natural length 1. The spring is constrained to oscillate in the r-y plane. Let the angle between the spring and the negative...

  • Let K= {0, 1,RX+1} be the four-element field constructed in Example 1 on 206-207. Write X2+X+ 1 a...

    Example 1 provided for reference. Let K= {0, 1,RX+1} be the four-element field constructed in Example 1 on 206-207. Write X2+X+ 1 as a product of factors of degree 1 in K[X] Example 1 The polynomialx) X2+ X+1 is irreducible in Za[XI, since it has no roots in Z2. Thus (X)) is a maximal ideal in Z,[X), and Z[X]/(f(X is a field. Let us denote it by K. To see what K looks like, notice that the coset g(X) determined...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT