Re: [algogeeks] Re: MATHS TRICK TEASER 9 may

2011-05-14 Thread amit kumar
superb answer by dave On Sun, May 15, 2011 at 8:27 AM, Amol Sharma wrote: > like utkarsh answer > -- > > > Amol Sharma > Second Year Student > Computer Science and Engineering > MNNIT Allahabad > > > > > On Wed, May 11, 2011 at 12:58 AM, Dave wrote: > >> 19 = XIX in Roman Numerals. Take 1 = I

Re: [algogeeks] Re: MATHS TRICK TEASER 9 may

2011-05-14 Thread Amol Sharma
like utkarsh answer -- Amol Sharma Second Year Student Computer Science and Engineering MNNIT Allahabad On Wed, May 11, 2011 at 12:58 AM, Dave wrote: > 19 = XIX in Roman Numerals. Take 1 = I away and you have XX = 20. > > Dave > > On May 10, 2:09 am, Lavesh Rawat wrote: > > *MATHS TRICK TE

[algogeeks] Re: Google Q

2011-05-14 Thread Dave
@Pacific: A balanced binary tree is commonly defined as a binary tree in which the height of the two subtrees of every node never differ by more than 1. Thus, there could be more nodes in one subtree than in the other. E.g., a balanced binary tree with 11 nodes could have 7 nodes in the left subtre

Re: [algogeeks] Re: A* search

2011-05-14 Thread xuwenduan
> After expanding B, the border is with G (25) > > Node G is the smallest of the border. > > You finish the algorithm when the node G is the smallest of the border not > when he enters the boundary Yes, we finish with G=25, but we still have G=35 first. This is all right, since I understand now th

Re: [algogeeks] first fit bin packing

2011-05-14 Thread pacific :-)
i think we can use heaps for this problem..bring to the root which has capacity to hold and pick the root each time. If the root cannot accomodate then no other node will be able to accomodate. On Sat, May 14, 2011 at 1:26 AM, MK wrote: > Consider the first fit strategy for online bin packing. >

Re: [algogeeks] Re: Google Q

2011-05-14 Thread pacific :-)
Will not a balanced binary tree do the job ? if we will pick the root each time for the median. On Sat, May 14, 2011 at 9:10 PM, Dave wrote: > @Ashish: The idea is to keep two heaps, a max-heap of the smallest > half of the elements and a min-heap of the largest elements. You > insert incoming

[algogeeks] Re: Array problem

2011-05-14 Thread amit
On May 13, 1:24 am, amit wrote: > Given an array A[i..j] find out maximum j-i such that A[i] O(n) time.#include using namespace std; #define max 12 int find(int a[],int i,int j) { while(i=j) return 0; } int main() { int a[max]={ 18,20,43,2,33,45,32,55,4,33,22,34

[algogeeks] Re: Google Q

2011-05-14 Thread Dave
@Ashish: The idea is to keep two heaps, a max-heap of the smallest half of the elements and a min-heap of the largest elements. You insert incoming elements into the appropriate heap. If the result is that the number of elements in the two heaps differs by more than 1, then you move the top element

Re: [algogeeks] Puzzle

2011-05-14 Thread Kunal Patil
Each team plays a total of 14 matches. Top 50% teams(4 out of 8) qualify for the semis. Thus, u must win more than 50% matches to be sure to get into semis. Thus, 8 is the answer. On Fri, May 13, 2011 at 12:14 AM, amit wrote: > Consider a series in which 8 teams are participating. each team play

Re: [algogeeks] Google Q

2011-05-14 Thread Ashish Goel
not clear, can u elaborate.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Fri, May 13, 2011 at 7:15 PM, Bhavesh agrawal wrote: > This problem can be solved using 2 heaps and the median can always be > accessed in O(1) time ,the first node. >

[algogeeks] Re: Inversion Count

2011-05-14 Thread bittu
@all i have posted the solution of same problem few times back , search in group thread i used BST & using that inversion count can be calculated in O(nlogn) if you found any error on that then let me know Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to

[algogeeks] Puzzle Digest Of The Week 9May - 13May

2011-05-14 Thread Lavesh Rawat
*Hi* *Puzzle Digest Of The Week 9May - 13May* * http://dailybrainteaser.ablogspot.com/2011/05/fun-math-puzzle-13-may.html?lavesh=lavesh * * * *http://dailybrainteaser.blogspot.com/2011/05/who-is-shortest-12-may.html?** lavesh=lavesh* * * *http://dailybrainteaser.blogspot.com/2011/05/fun-teaser-1