[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
correction-->>"Then C loses two of its matches to(one to A and one to C). " to "Then C loses two of its matches to(one to A and one to B) ". On May 27, 7:44 pm, vishwakarma wrote: > so here we go > > Let A loses two of its matches to (one to B and one to C

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
correction---it was typo mistake ... Team C loses to(one to A and one to B) On May 27, 7:44 pm, vishwakarma wrote: > so here we go > > Let A loses two of its matches to (one to B and one to C). > Let B loses two of its matches to(one to A and one to C) > Then C loses two of

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
n May 27, 7:27 pm, Arpit Mittal wrote: > @Vishwakarma > > it is now ok that 11 should be the answer, but why any 4 teams cannot win 12 > matches in total... > > for that they have to score 12*4 = 48 points out of 56. then wats the > problem. > > i know how it is coming 11 no

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
@Arpit Any four team cannot win 12 matches in total. ...Rishabh is wid right answer that is ( " 11 " ). Hence any team winning its any 11 out of 14 matches ensures its entry to semis. But not below 11 its entry to semi will depend on other team performance. On May 27, 7:11 pm, Arpit Mittal

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
sorry !!! correction-->>..i misread the problem My solution gives "what is the lowest possible number of matches won by a qualifying team ". On May 27, 6:37 pm, vishwakarma wrote: > Correct me if i m wrong !!! > > Number of matches of each team  = 14. > Let team A

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
Correct me if i m wrong !!! Number of matches of each team = 14. Let team A,B,C,D qualify for semifinal. 1.maximum number of matches A can win = 14 (all played ) 2.maximum number of matches B can win = 12 (all played except played with team A) 3.maximum number of matches C can win = 10 (all play

[algogeeks] Re: Round Robin Schedulling Problem

2011-05-26 Thread vishwakarma
wait !! wait !! @Anshuman sir...u have left few case ; I corrected ur code and got accepted at spoj. Here is the correct code; //here F[] is array which got 3 fields ( element value(same as ur D[] array) , its index in original input(same as ur IN[] array) , number of elements less than it till

[algogeeks] Re: Round Robin Schedulling Problem

2011-05-26 Thread vishwakarma
@Anshuman sir There is mistake in above code : u wrote -->> " ans[IN[i]] = curtime + (D[i] - last - 1) * rem + (i - L[IN[i]] + 1); " I think it should be -->> "ans[IN[i]] = curtime + (D[i] - last - 1) * rem + (IN[i]- L[IN[i]] + 1); correct me if i m wrong On May 26, 9:17 am, anshu mishra

[algogeeks] Re: number of inversions

2011-04-23 Thread vishwakarma
u can use BIT(Binary Indexed Tree) to count inversions. I prefer this becoz it is much easier to code BIT than merge sort. On Apr 24, 4:25 am, سهراب ابوالفتحی wrote: > Let A[1..n] be an array of n distinct numbers. If i < j and A[i] > A[j], > then the pair (i,j) is called an inversion of A. Give

[algogeeks] Re: Dp problem

2011-04-14 Thread vishwakarma
Here i proposed an algorithm. correct me if i am wrong !! int main() { int N; //number of boards int W; // number of workers int smax = 0; cin >> N >> W; int *A = new int[N]; for(int i=0;i> A[i]; smax += A[i]; } int

[algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-04-14 Thread vishwakarma
occurence is greater than n/2 than u ll always get an unique value left after step 1 , it wont depend on the way u select 2 different element n removing them. On Apr 15, 12:43 am, vishwakarma wrote: > Let A be the input array; > > Now algorithm is follows; > > struct

[algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-04-14 Thread vishwakarma
elp . > > On Fri, Apr 15, 2011 at 12:52 AM, vishwakarma > wrote: > > > > > I can post solution of this complexity if you want !! > > > On Apr 15, 12:19 am, vishwakarma wrote: > > > complexity : O(n) + O(nlogn) > > > > Sweety wrote: > >

[algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-04-14 Thread vishwakarma
I can post solution of this complexity if you want !! On Apr 15, 12:19 am, vishwakarma wrote: > complexity : O(n) + O(nlogn) > > Sweety wrote: > > Question :Let A[1..n] be an array of integers. Design an efficient > > divide and conquer algorithm to determine if A contains a

[algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-04-14 Thread vishwakarma
complexity : O(n) + O(nlogn) Sweety wrote: > Question :Let A[1..n] be an array of integers. Design an efficient > divide and conquer algorithm to determine if A contains a majority > element, i.e an element appears more than n/2 times in A. What is the > time complexity of your algorithm? > > Answ