Question: Matlab question Open Save Compare - Print Go To - Find Comment % Indent Run Section Advance Breakpoints Run - e 0 Run and Time

 Matlab question Open Save Compare - Print Go To - FindMatlab question
Comment % Indent Run Section Advance Breakpoints Run - e 0 Run

Open Save Compare - Print Go To - Find Comment % Indent Run Section Advance Breakpoints Run - e 0 Run and Time Run and Advance NAV GATE A PONTS function [b] = has_repeat( v ) E% Say v = [a,b,c,d] % Check a vs b, a vs c, a vs d, bvs c, b vs d, cvs d b = 0; for i = 1: length(v) for j = i+1: length(v) if v(i) == v(j). b = 1; return; U end WNPUU end end end NO 1. a. Consider the has repeat function from the "has repeat" video. If the input vector v is length 6, what is the fewest possible times that the line 'if v(i) == V(i) could be executed? b. Consider the has repeat function. If the input vector v is length 6, what is the most possible times that the line 'if y(i)=v(j) could be executed? c. Give an example of a length 6 vector for which the line 'if v(i) == V() is executed exactly 10 times. (Hint. Check your answer using debugging mode.) d. True/False: If the line 'if v(i) = v(j)' is executed the maximum number of times, then the output must be 0. Briefly explain your answer. e. What single line of code could be removed to make the line 'if v(i) == v(j)' always be exe- cuted the maximum number of times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!