question archive The following algorithm can find all the pairs of values from a given list of k numbers (N1, N2,
Subject:Computer SciencePrice:4.86 Bought8
The following algorithm can find all the pairs of values from a given list of k numbers (N1, N2, ..., Nk) with the addition of each pair is equal to SUM. 1. Please fill out each blank below, and make it to be in RED color.
==============Code Begin=====================
Step 1: Get the values for N1, N2, ..., Nk, and SUM
Step 2: Set the value of i to ____
Step 3: Set the value of j to ___
Step 4: Set Flag to be False
Step 5: While (i < k) do steps ____ through ____
Step 6: While ( ___,<= k) do steps 7 through 10
Step 7: If Ni + Nj = _____ then
Step 8: Print (Ni, Nj)
Step 9 Flag = _____
Else
Step 10: Set the value of j to ____
Step 11: Set the value of i to i + 1
Step 12: Set the value of j to _____
Step 13: If Flag == _____ Then
Print the message 'Sorry, there is no such pair of values.'
Else
Print the message 'I am done.'
=============Code End========================
2. Please analyze the time performance for the above algorithm in Big-O notation.
Answer:
Purchased 8 times