[algogeeks] Re: for loop performace in terms of speed makes any difference when we run from max to min and min to max

2010-11-24 Thread shiva
After googling i came to know that comparison with 0 takes less time
than comparing with some other number.So decremental loop is
fast(difference is very very low)

On Nov 22, 5:42 pm, rahul patil rahul.deshmukhpa...@gmail.com wrote:
 Might be its is due to the comparison operation which takes many cycles

 i  max takes more cycles of cpu than just simply checking i

 On Sun, Nov 21, 2010 at 6:50 PM, shiva shivanand.kadwad...@gmail.comwrote:



  I want to know is there any difference between following two loop in
  terms of speed.

  1.
  for(i=0;imax;i++)
  {

  //Some operation
  }
  2.
  for(i=max; i; i--)
  {

  /Some operation

  }

  I heard second one is faster but don't have any proof

  Please comment.

  --
  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.comalgogeeks%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

 --
 Regards,
 Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Please let me if you are working on Friday.

2010-11-24 Thread k shivaprasad
Hello Friends,

Please let me if you are working on Friday.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Please let me know if you are working on Friday.

2010-11-24 Thread k shivaprasad
Hello Friends,

Please let me know  if you are working on Friday.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] multisorted aarray

2010-11-24 Thread MAC
You are given a array with rows sorted and column sorted. You have to print
entire array in sorted order .. any idea??

-- 
thanks
--mac

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Please let me know if you are working on Friday.

2010-11-24 Thread Salil Joshi
what does that mean??


On Wed, Nov 24, 2010 at 7:51 PM, k shivaprasad ksp.pra...@gmail.com wrote:

 Hello Friends,

 Please let me know  if you are working on Friday.

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 


Thanks  Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] multisorted aarray

2010-11-24 Thread vaibhav agrawal
Merge Sort on rows??

On Wed, Nov 24, 2010 at 8:50 PM, MAC macatad...@gmail.com wrote:

 You are given a array with rows sorted and column sorted. You have to print
 entire array in sorted order .. any idea??

 --
 thanks
 --mac

  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] BST to Double Linked List Without Using Extra Space

2010-11-24 Thread vamsee marpu
Hi,


 Can anybody help me in solving the following problem:


Convert a binary search tree in to a doubly linked list in level order
without using extra space :


BST
   1
  /  \
 2   3
/  \ /  \
  4  5 6  7

in to double linked list as:  1==2==3==4==5==6==7


I can do it using level order traversal using a queue, but the problem says
no extra space should be used, I tried a lot but can't able to figure out.



Thanks,
M. Vamsee

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: for loop performace in terms of speed makes any difference when we run from max to min and min to max

2010-11-24 Thread Rishi Agrawal
I think the compiler today can identify this optimization and thus the final
code will be the same.

You can check the assembly code generated by the gcc compiler for both the
loops.

On Wed, Nov 24, 2010 at 4:29 PM, shiva shivanand.kadwad...@gmail.comwrote:

 After googling i came to know that comparison with 0 takes less time
 than comparing with some other number.So decremental loop is
 fast(difference is very very low)

 On Nov 22, 5:42 pm, rahul patil rahul.deshmukhpa...@gmail.com wrote:
  Might be its is due to the comparison operation which takes many cycles
 
  i  max takes more cycles of cpu than just simply checking i
 
  On Sun, Nov 21, 2010 at 6:50 PM, shiva shivanand.kadwad...@gmail.com
 wrote:
 
 
 
   I want to know is there any difference between following two loop in
   terms of speed.
 
   1.
   for(i=0;imax;i++)
   {
 
   //Some operation
   }
   2.
   for(i=max; i; i--)
   {
 
   /Some operation
 
   }
 
   I heard second one is faster but don't have any proof
 
   Please comment.
 
   --
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  Regards,
  Rahul Patil

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards,
Rishi Agrawal

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.