[algogeeks] Re: LOGIC!!!

2012-08-30 Thread Don
For each employee, keep track of which vacation he is assigned to, if any. Start with all employees unassigned. 1. Pick the first pair who have worked together and are currently unassigned. Assign one to Trip A and the other to Trip B. 2. Loop over all pairs. If a pair are assigned to the same

Re: [algogeeks] Re: logic???????????

2011-08-13 Thread Kunal Patil
@Yasir: Yups...I also have the same algo... Just to improvise your solution, you need not do binary search on both sides of the pivot. Just check End points (min-max) of the both sub-array to decide which side to do a binary search..This works in the case of duplicate elements too. for e.g. 2 5

Re: [algogeeks] Re: logic???????????

2011-08-13 Thread Yasir
Yeah got it. Thanks :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/NAqtuyQmehgJ. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Re: logic???????????

2011-08-12 Thread KK
Check this out //But this and fails for input such as: 101 ie all nos must be unique.. int search_element_in_rotated_array(int *a, int low, int high, int key) { while(low = high) { int mid = low + (high - low)/2; if(a[mid] == key) return

Re: [algogeeks] Re: logic???????????

2011-08-12 Thread sagar pareek
nope it will not work top kya lower part bhi sorted hai.. like 7 8 9 1 2 3 4 5 6 do it with this i/p... it will fail ur algo will do same thing for 8 and 4 FAIL !!! On Fri, Aug 12, 2011 at 9:27 PM, KK kunalkapadi...@gmail.com wrote: Check this out //But this and fails for input

Re: [algogeeks] Re: logic???????????

2011-08-12 Thread Yasir
how abt http://ideone.com/lN2og ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/pZdvFb_t2b4J. To post to this group, send email to