On Thu, Nov 17, 2011 at 4:05 PM, shady sinv...@gmail.com wrote:
you can't do binary search with linked lists.
Yes you can do the binary search on the linked list.
But the only difference it makes from the array is that array elements can
be accessed in O(1) time and finding the mid in array is
roflmao, that's what i mean, else the whole purpose of binary search is
defeated, instead just linearly traverse the array and find the element
On Thu, Nov 17, 2011 at 4:17 PM, sumit mahamuni
sumit143smail...@gmail.comwrote:
On Thu, Nov 17, 2011 at 4:05 PM, shady sinv...@gmail.com wrote:
Hello All,
What every algorithm mentioned above have some problem.
The Recursive swapping won’t work if you don’t have 2^n elements.
Same with getting the indexes, it will form a cycle.
Thanks
Pramod Negi
On Fri, Jun 11, 2010 at 7:09 PM, sharad kumar sharad20073...@gmail.comwrote:
excellent soln!!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
nice algo!
Anurag Sharma
On Wed, Jun 9, 2010 at 11:23 PM, souravsain souravs...@gmail.com wrote:
Guys
We can solve this in O(n) time like this:
Let me say total elements in array is 2N such that 1 to N are a's and N
+1 to 2N (which I will again refer to as 1 to N) are b's
Observation:
here is a sel explainatory algo
given:
abcd1234
abc1d234
ab1c2d34
a1b2c3d4
here is the link for the code : http://codepad.org/SZnufGc6
--
Regards
Jitendra Kushwaha
MNNIT, Allahabad
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
Its not O(n) time.
Anurag Sharma
On Wed, Jun 9, 2010 at 5:46 PM, Jitendra Kushwaha
jitendra.th...@gmail.comwrote:
here is a sel explainatory algo
given:
abcd1234
abc1d234
ab1c2d34
a1b2c3d4
here is the link for the code : http://codepad.org/SZnufGc6
--
Regards
Jitendra Kushwaha
which is just the recursive version of the abovementioned iterative
solution.
P.S. -Please remove this quoted text when you are composing
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay