Hi,
If the array A is a list of consecutive N natural numbers,
then missing number,n = Sum of N natural numbers + Sum of the numbers in
Array A.
Regards,
Suvajit
Jabir Ahmed wrote:
Hello
I need to know the best way to get a missing element
from an array.
i have an array @a of size containing values 1 to 101
with one value missing.
eg: @a=qw( 1 2 3 4 5 6 8 9 10 .... 101);
(the array is not sorted and its only to make it
easier to understand)
now i need to find out the missing value i.e 7 .
if i run a loop then it needs to run n x n number of
times.
kindly suggest.
Thanks
Jabir
I do the diffcult immediately,but the impossible take's a little longer!!!
Cresent canaopy apartments
#19 Davis Road,
Thomas town,
Bangalore -84
Phone (mobile) : +91-98867 01148
E-Mail: [EMAIL PROTECTED],[EMAIL PROTECTED]
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>