[Solved] Suppose you are given a set P of integers and another integer x

$25

File Name: Suppose_you_are_given_a_set_P_of_integers_and_another_integer_x.zip
File Size: 593.46 KB

SKU: [Solved] Suppose you are given a set P of integers and another integer x Category: Tag:
5/5 - (1 vote)

1. Suppose you are given a set P of integers and another integer x. We wish to use a (n2) algorithm to decide whether there are 3 integers in P and the sum of these three integers equals to x. Show your algorithm and indicate why its complexity is (n2). (You can use pseudo code or by illustration only)

IF-EQUALS-SET(x, P)

for i 1 to P.size 2

for j i + 1 to P.size 1

if P[i] + P[j] + P[P.size] = x

return true

return false

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Suppose you are given a set P of integers and another integer x
$25