[algogeeks] LOGIC!!!

2012-08-30 Thread ashish mann
Q. A company organizes two foreign trips for its employees yearly. Aim of the trip is to increase interaction among the employees of the company and hence company wants each of his employee to see new people on the trip and not even a single person with whom he has worked in past. Therefore it is

Re: [algogeeks] LOGIC!!!

2012-08-30 Thread Saurabh Kumar
I think, if the Graph is 2-colorable (i.e. Bipartite) trip can be arranged. On 30 August 2012 09:43, ashish mann ashishman...@gmail.com wrote: Q. A company organizes two foreign trips for its employees yearly. Aim of the trip is to increase interaction among the employees of the company and

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

2011-08-13 Thread WgpShashank
@Sagar Dude , oh common shashank...its not that easy u told. I Hope You Understand the question properly ? or you are talking about *bitonic sequence* if not then just point the obvious or no-obvious bug in above algorithm, Same Algo is coded below by Yasir, also Kunal Also suggested some

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

2011-08-13 Thread sagar pareek
kk On Sat, Aug 13, 2011 at 9:26 PM, WgpShashank shashank7andr...@gmail.comwrote: @Sagar Dude , oh common shashank...its not that easy u told. I Hope You Understand the question properly ? or you are talking about *bitonic sequence* if not then just point the obvious or no-obvious bug in

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

2011-08-13 Thread sagar pareek
First of all how will u know the pivot points if u don't know original array secondly if u know pivot points and suppose u want to find 12 in ur above example then how will u first of all find 2 as u dont know the shift number On Sun, Aug 14, 2011 at 1:36 AM, sagar pareek sagarpar...@gmail.com

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

2011-08-13 Thread Yasir
@Sagar ..an array which is sorted but rotated by some k places which is nt kwn Kindly note that: ARRAY IS KNOWN, k is NOT known. If the array is not known then where will you search an item??? :P :P -- You received this message because you are subscribed to the Google Groups Algorithm

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

2011-08-13 Thread sagar pareek
arey mean original array. array without rotation :D and if u know the pivot point then how u will came to know its position in rotated array... like in above example we have to search 12 then how will u know abt position of 2? On Sun, Aug 14, 2011 at 6:15 AM, Yasir yasir@gmail.com wrote:

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

2011-08-13 Thread Gaurav Menghani
After finding the pivot, can't we just use the normal binary search, just change the array notation to use modular arithmetic. i.e, instead of arr[i], use arr[(i+k)%n], where n is the number of elements in the array. Rest of the code remains same. On Sun, Aug 14, 2011 at 10:41 AM, sagar pareek

[algogeeks] logic???????????

2011-08-12 Thread jagrati verma
to implement a binary search in an array which is sorted but roated by some k places which is nt kwn time complexity O(logn) -- 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.

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

2011-08-12 Thread Amol Sharma
i doubt if it is possible in O(logn). i think you can first 'k' in one traversal and then make the array as it was before in O(n) and then apply binary search.so its basically a O(n) solution... if anyone has better ideas then please share !!. -- Amol Sharma Third Year Student Computer

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

2011-08-12 Thread WgpShashank
Hi Guys Here is the algorithm for doing same in O(logn) Hint : Find the pivot point, divide the array in two sub-arrays and call binary search. Thats It :) Algorithm 1. A Pivot Point is point around which array is rotated so 1st we need to find out its location/index. lets say it pivot.

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

2011-08-12 Thread sagar pareek
oh common shashank...its not that easy u told. just do codingthen u will find the error in ur logic On Fri, Aug 12, 2011 at 6:25 PM, WgpShashank shashank7andr...@gmail.comwrote: Hi Guys Here is the algorithm for doing same in O(logn) Hint : Find the pivot point, divide the array in

Re: [algogeeks] logic error:

2011-06-09 Thread sunny agrawal
check your this if condition if(tmap.end()-second=4) { ans=tmap.end()-first; } it should be == , not = On Thu, Jun 9, 2011 at 5:09 PM, John Hayes agressiveha...@gmail.com wrote: Hello every one i tried to code the same problem using STL mapsbut getting the RUN TIME

[algogeeks] logic error:

2011-06-06 Thread PRAMENDRA RATHi rathi
i am thinking that the team with win point 4 will be the winner .. is this wrong? https://www.spoj.pl/problems/SBETS/ because there are only 16 match 8+4+2+1(final) +1(for runner up) so any team can play at max 4 match. -- You received this message because you are subscribed to the Google

Re: [algogeeks] logic error:

2011-06-06 Thread arun kumar
any team which has nt lost a match will win On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi prathi...@gmail.com wrote: i am thinking that the team with win point 4 will be the winner .. is this wrong? https://www.spoj.pl/problems/SBETS/ because there are only 16 match 8+4+2+1(final)

Re: [algogeeks] logic error:

2011-06-06 Thread nicks
@parmendra..yeah u r right what's ur problem u r not able to implement it r whatonly winner will win 4 matches runner and 3rd posn will win 3 match each... On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote: any team which has nt lost a match will win On Mon, Jun 6,

Re: [algogeeks] logic error:

2011-06-06 Thread PRAMENDRA RATHi rathi
no, i am getting wrong answer again with this logic.. it is my code:: int main() { register int test,i,j,winner=0,g1,g2; string s1,s2; string team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG}; cin test; while(test--) { int point[16]={0}; for(j=0;j16;j++) { cins1s2g1g2;

Re: [algogeeks] logic error:

2011-06-06 Thread Logic King
How can you assume that team name cannot be other than these.where in the question is written that only these teams will constitute the last 16. i hope you got my point and your mistake as well !! On Mon, Jun 6, 2011 at 4:28 AM, PRAMENDRA RATHi rathi prathi...@gmail.comwrote: no, i am

Re: [algogeeks] logic error:

2011-06-06 Thread saurabh singh
Agree with logic king...Moreover have you thouht of using maps?That will improove your code's efficiency(With respect to current code) and also make it shorter, On Mon, Jun 6, 2011 at 5:12 PM, Logic King crazy.logic.k...@gmail.comwrote: How can you assume that team name cannot be other than

Re: [algogeeks] logic error:

2011-06-06 Thread PRAMENDRA RATHi rathi
tnx all of u...what a foolish mistake i hd done:P On Mon, Jun 6, 2011 at 10:38 PM, saurabh singh saurab...@gmail.com wrote: Agree with logic king...Moreover have you thouht of using maps?That will improove your code's efficiency(With respect to current code) and also make it shorter,