Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def colours(guess:tuple, hidden:tuple) -> int: Preconditions: - guess is a sequence of four unique colours chosen from R, O, Y, G, B, V; -

def colours(guess:tuple, hidden:tuple) -> int: """ Preconditions: - guess is a sequence of four unique colours chosen from R, O, Y, G, B, V; - hidden is a sequence of four unique colours chosen from R, O, Y, G, B, V; Postconditions: output is number of correct colours in guess """ correct = 0 for colour in ('R','O','Y','G','B','V'): if colour in guess and colour in hidden: correct = correct + 1 return correct colours(['R','B','O','G'],['R','B','V','O'])

Q1(a) (6 marks)

What is the worst-case complexity of colours? What is the worst-case complexity of positions? Explain your answers.

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

More Books

Students also viewed these Databases questions

Question

How is workforce planning linked to strategic planning?

Answered: 1 week ago