Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Not sure how to start this problem from my Discrete Structures and Algorithms classs? Suppose you have a robot that you are trying to program

Not sure how to start this problem from my Discrete Structures and Algorithms classs?image text in transcribed

Suppose you have a robot that you are trying to program to paint floor patterns for you. This robot can only understand a few simple commands: 1. F: move forward one space 2. R: turn right 90 3. L: turn left 90 4. P: paint the floor underneath For example, the program "F F P tells the robot to move two steps forward and then paint the floor directly underneath it. 1. Write a program that paints the floor pattern below. Assume that X means that tile should be painted and that the robot always begins in the bottom left corner facing upwards. How long is your program in terms of number of commands? If the floor was of size n-by-n, give a big-O estimate for how long your program would be to paint the same pattern. Hint first try writing a program for a 5-by-5 floor then a 6-by-6 floor and see if you can find a pattern Suppose you have a robot that you are trying to program to paint floor patterns for you. This robot can only understand a few simple commands: 1. F: move forward one space 2. R: turn right 90 3. L: turn left 90 4. P: paint the floor underneath For example, the program "F F P tells the robot to move two steps forward and then paint the floor directly underneath it. 1. Write a program that paints the floor pattern below. Assume that X means that tile should be painted and that the robot always begins in the bottom left corner facing upwards. How long is your program in terms of number of commands? If the floor was of size n-by-n, give a big-O estimate for how long your program would be to paint the same pattern. Hint first try writing a program for a 5-by-5 floor then a 6-by-6 floor and see if you can find a pattern

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions