We can follow an algorithm described below.
Set found:= FALSE
For each number n belong to array A.and until found != TRUE
For each number k in A not equal to n, do:
if k+n == m then
output "The pairs are n and k"
Set found:=TRUE.
Break.
The running time will be of O(n^2).
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.