[algogeeks] Problem 4.2 from Introduction to algorithms

2006-11-17 Thread Norbert
Hi, please help me solve this problem. It's something like that: given an array A[1...n] filled with different integers in range [1...n], find a missing number. The only operation which you can use is get_ith_bit_from_pos_n(i, n) = i'th bit of A[n]. This can be solved in O(n) time. But how?

[algogeeks] Re: Problem 4.2 from Introduction to algorithms

2006-11-17 Thread Idris
Is this extracting i'th bit from a[X] or just extracting Integer from i th index of an array??? if its the later, then get the number and sum up by using OR operation not sure:-) then subtract it from n(n+1)/2=missing Number --~--~-~--~~~---~--~~ You

[algogeeks] Re: Problem 4.2 from Introduction to algorithms

2006-11-17 Thread Norbert
extract(i, n) - i'th bit from position n in an array A - i'th bit of A[n] On 11/17/06, Idris [EMAIL PROTECTED] wrote: Is this extracting i'th bit from a[X] or just extracting Integer from i th index of an array??? if its the later, then get the number and sum up by using OR operation

[algogeeks] Minimal path sum - part #2

2006-11-17 Thread [EMAIL PROTECTED]
yes, this one was copy/pasted from : http://groups.google.com/group/algogeeks/browse_thread/thread/8b9ed1060e275f29/a797db6ebd94035f?lnk=stq=minimal+path+sumrnum=1#a797db6ebd94035f as i noticed noone seen it :) Hello, first of all, thanks to all for help! as Lego Haryanto alredy guessed, this

[algogeeks] Array moving left

2006-11-17 Thread Nik
Hi, I have an array in which elements are present . The number of elements n = 10^6 . Now if i delete an element in the array, i want to update the array by moving all the elements to the left. It is very slow considering the size of element and i want to access the array with new updated

[algogeeks] Re: How to check the subsequence whose some is 0 in array of both + and -ve Integers?

2006-11-17 Thread Arun
search for maximum subsequence problem. urs is a special case of that. On 11/16/06, Idris [EMAIL PROTECTED] wrote: You can use N space.:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: Move array left

2006-11-17 Thread Nik
Arun wrote: On 11/17/06, Nik [EMAIL PROTECTED] wrote: Hi, I have an array in which elements are present . The number of elements n = 10^6 . Now if i delete an element in the array, i want to update the array by moving all the elements to the left. It is very slow considering

[algogeeks] Re: Problem 4.2 from Introduction to algorithms

2006-11-17 Thread Dhyanesh (ધયાનેશ)
1) Scan through the array counting number of 0s and 1s in MSB, as well as separating the 0s into an array arr0 and 1s into an array arr1 (if you do not want to use extra space you can use splitting around pivot pass of quicksort). 2) You would know how many 0s and 1s should be present in MSB for

[algogeeks] Re: How to check the subsequence whose some is 0 in array of both + and -ve Integers?

2006-11-17 Thread Idris
can u pls explain it?:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] Re: How to check the subsequence whose some is 0 in array of both + and -ve Integers?

2006-11-17 Thread Idris
sorry it sum note some:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL

[algogeeks] Re: Problem 4.2 from Introduction to algorithms

2006-11-17 Thread Arun
neat solution :) On 11/17/06, Dhyanesh (ધયાનેશ) [EMAIL PROTECTED] wrote: 1) Scan through the array counting number of 0s and 1s in MSB, as well as separating the 0s into an array arr0 and 1s into an array arr1 (if you do not want to use extra space you can use splitting around pivot pass of