- In the extension bar, click the AdBlock Plus icon
- Click the large blue toggle for this website
- Click refresh
- In the extension bar, click the AdBlock icon
- Under "Pause on this site" click "Always"
- In the extension bar, click on the Adguard icon
- Click on the large green toggle for this website
- In the extension bar, click on the Ad Remover icon
- Click "Disable on This Website"
- In the extension bar, click on the orange lion icon
- Click the toggle on the top right, shifting from "Up" to "Down"
- In the extension bar, click on the Ghostery icon
- Click the "Anti-Tracking" shield so it says "Off"
- Click the "Ad-Blocking" stop sign so it says "Off"
- Refresh the page
- In the extension bar, click on the uBlock Origin icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the uBlock icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the UltraBlock icon
- Check the "Disable UltraBlock" checkbox
- Please disable your Ad Blocker
- Disable any DNS blocking tools such as AdGuardDNS or NextDNS
- Disable any privacy or tracking protection extensions such as Firefox Enhanced Tracking Protection or DuckDuckGo Privacy.
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
toothy1911
Hi, i really need some help on tracing an algorithm, and aswering a few questions.
Any support you could give me would be greatly appreciated, the algorithm and questions i an stuck on are as follows:
--------------------------------------------------------------------------------------------------
This is an algorithm trace task. No implementation is required.
Read the following algorithm for the recursive function called Mystery. X( ) is a one-dimensional array.
Function Mystery(X( ), N)
IF N = 1 THEN
Mystery = 1
ELSE
Temp = Mystery(X( ), N - 1)
IF X(N) >= X(Temp) THEN
Mystery = N
ELSE
Mystery = Temp
ENDIF
ENDIF
End Function Mystery
(a) Write down the exact output when the function is called with
(i) Output ?The answer is: ?, Mystery(A( ), 5)
if A(1) = 6, A(2) = 10, A(3) = 6, A(4) = 18, A(5) = 15.
(ii) Output ?The answer is: ?, Mystery(A( ), 5)
if A(1) = 16, A(2) = 18, A(3) = 12, A(4) = 15, A(5) = 18.
(b) The function is called with
Mystery(A( ), 3)
where A(1) = 28, A(2) = 20 and A(3) = 28.
Produce a diagram showing each step of the algorithm and the function calls.
© Describe the purpose of the algorithm.
(d) Write an iterative algorithm that does the same task as the recursive algorithm.
--------------------------------------------------------------------------------------------------
ps i already know how to set out a diagram showing each step of the algorithm and the function calls.
Thank:)again :)
Link to comment
https://www.neowin.net/forum/topic/274176-algorithm-trace/Share on other sites
6 answers to this question
Recommended Posts