[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 Gene
This of course depends on the processor, the compiler, and the optimization settings you choose. On some processors like x86, 2 might compile to slightly smaller code because the decrement instruction instruction also sets the condition codes, and the conditional branch can use this result. On th

[algogeeks] Re: multisorted aarray

2010-11-24 Thread juver++
http://lyle.smu.edu/~saad/courses/cse3358/ps5/problemset5sol.pdf On Nov 24, 6:20 pm, MAC 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 subscri

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

2010-11-24 Thread juver++
Process tree in the level order traversal, but instead queue you mau use partially constructed list of nodes (which will be the exact result). Remember the first node of the (i-1)-th level in the list. Process nodes and add its child. And so on. On Nov 24, 6:35 pm, vamsee marpu wrote: > Hi, > >

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

2010-11-24 Thread vaibhav agrawal
If BST is stored in an array, which is already in level order, then there is nothing much remaining to do. On Wed, Nov 24, 2010 at 9:05 PM, vamsee marpu wrote: > Hi, > > > Can anybody help me in solving the following problem: > > > Convert a binary search tree in to a doubly linked list in level

Re: [algogeeks] Dynamic prog.

2010-11-24 Thread Amir hossein Shahriari
you can use an algorithm similar to matrix chain multiplication i.e. if dp[i][j] is the maximum value that you can get with the numbers v_i to v_j and in order to maximize it find k that maximizes ( dp[i][k] op_k dp[k][j] ) v_i is the ith value and op_k is the kth operator obviously if i==j : dp

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 wrote: > After googling i came to know that comparison with 0 takes less ti

[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 / \

Re: [algogeeks] multisorted aarray

2010-11-24 Thread vaibhav agrawal
Merge Sort on rows?? On Wed, Nov 24, 2010 at 8:50 PM, MAC 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

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 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

[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...@googlegrou

[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+unsubs

[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...@

[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 wrote: > Might be its is due to the comparison operation which takes many cycles > > i < max takes mo