Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedMatlab question
image text in transcribed
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

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago