خرید بک لینک

Vote count: 0

I am trying to come up with a pseudocode brute-force algorithm that finds the largest product of two numbers in a list a[sub1] to a[subn], with n greater than or equal to 2. Right now, I have

for ( i = 1 to n -1)

a[subi] = a[subi-1] * a[subi+1]

for (j = a[sub j+1] to n)

a[sub j] = a[sub j-1] * a[sub j+1]

end for

end for

retu a[sub i]

retu a[sub j]

However, this is not correct. I feel like there's something simple I'm missing here, but I can't figure it out. Any ideas? Thanks in advance.

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 14 اسفند 1394 ساعت: 8:43

صفحه بندی