Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (5 points) LO3, Consider the quilt of hexagonal patches discussed in the class. Design an algorithm to determine the number of blue patches
1. (5 points) LO3, Consider the quilt of hexagonal patches discussed in the class. Design an algorithm to determine the number of blue patches given the input and output below. Algorithm Blue Patches 1: Input: A sequence of colors (red, green, blue) for n 2 hexagons 2: Output: The number of blue patches 2. (5 points) LO3. Design an algorithm that takes a list of cyclically right shift the input list by s positions, where 1 is 3, 4, 12, 9, 8, 7 and a 3, the output must be 9, 8, 7, 3, 4, 12. Justify if it is a valid algorithm. You must not use an extra array other than that needed to store the input list. 3. (5 points) LO4. From the algorithm below, work out the counts of basic operations C(n) and its the growth order. Algorithm Mystery 1: Input: Positive integer n 2: Output: 3: 14-0 4 for i:=1 to n - 1 do 5: integers and produces an output list that n-1. For example, suppose your input for ji+1 to n do for k:=1 toj do rir+1 6: 7: 8: return/
Step by Step Solution
★★★★★
3.45 Rating (164 Votes )
There are 3 Steps involved in it
Step: 1
Answer 1 Algorithm Blue Patches 1 Input A sequence of colors red green blue for n 2 hexagons 2 Outpu...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started