How many comparisons does this algorithm has? Algorithm1(A[0 .... n- 1]) // Input: Array A[0 ...n- 1] of numbers count 0 for i = 1 to n- 2 do for j=i+2 ton do if |A[i] – A[j]]


How many comparisons does this algorithm has?<br>Algorithm1(A[0 .... n- 1]) // Input: Array A[0 ...n- 1] of numbers<br>count 0<br>for i = 1 to n- 2 do<br>for j=i+2 ton do<br>if |A[i] – A[j]] < 10<br>count count + 1<br>r'eturn count<br>n(n-1)/2<br>n(n-1)/2<br>(n-1)(n-2)/2<br>(n-1)(n-2)2<br>Dws ba<br>LA<br>

Extracted text: How many comparisons does this algorithm has? Algorithm1(A[0 .... n- 1]) // Input: Array A[0 ...n- 1] of numbers count 0 for i = 1 to n- 2 do for j=i+2 ton do if |A[i] – A[j]] < 10="" count="" count="" +="" 1="" r'eturn="" count="" n(n-1)/2="" n(n-1)/2="" (n-1)(n-2)/2="" (n-1)(n-2)2="" dws="" ba="">

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here