[algogeeks] Google Interview Question

2010-12-24 Thread bittu
Boolean tree problem: Each leaf node has a boolean value associated with it, 1 or 0. In addition, each interior node has either an AND or an OR gate associated with it. The value of an AND gate node is given by the logical AND of its two children's values. The value of an OR gate likewise is

[algogeeks] SUN Microsystem Question

2010-12-24 Thread bittu
You Have File of Containing 1 Million Integers You need To Find 10 Maximum Integer Out of Them.How You Will Do That ...what is Time space Complexcity of Algorithm that you will usethen optrmize the solution.. Constraints- U can't Store Whole File in memory @ one time e.g. if u will do that

[algogeeks] amazon interview question

2010-12-24 Thread MAC
Given a boolean matrix with all the true elements on left side in the row so that each row can be broken into two parts left part containing only true elements and right part containing only false elements. Find the row with max number of true elements in it. 00011 0 1 true is 0 false

[algogeeks] Re: amazon interview question

2010-12-24 Thread MAC
updated :) Given a boolean matrix with all the true elements on left side in the row so that each row can be broken into two parts left part containing only true elements and right part containing only false elements. Find the row with max number of true elements in it. 00011 0 1

Re: [algogeeks] Google Interview Question

2010-12-24 Thread Terence
Using the same level order traversal (bottom up), calculating the minimum flips to turn each internal node to given value (0/1). On 2010-12-24 17:19, bittu wrote: Boolean tree problem: Each leaf node has a boolean value associated with it, 1 or 0. In addition, each interior node has either

Re: [algogeeks] Re: Array Ranking Problem

2010-12-24 Thread Terence
My method is using DP, as Snehal have pointed out. Suppose S[0..n-1] and T[0..n-1] denotes the score and time for the n questions respectively. C[k][s] denotes the maximum total time when choosing from the first k questions such that the total score do not exceed s. Then C[0][s] = 0

Re: [algogeeks] SUN Microsystem Question

2010-12-24 Thread vinayan c
use B-trees On Fri, Dec 24, 2010 at 6:32 PM, bittu shashank7andr...@gmail.com wrote: You Have File of Containing 1 Million Integers You need To Find 10 Maximum Integer Out of Them.How You Will Do That ...what is Time space Complexcity of Algorithm that you will usethen optrmize the

Re: [algogeeks] SUN Microsystem Question

2010-12-24 Thread dinesh bansal
On Fri, Dec 24, 2010 at 3:02 PM, bittu shashank7andr...@gmail.com wrote: You Have File of Containing 1 Million Integers You need To Find 10 Maximum Integer Out of Them.How You Will Do That ...what is Time space Complexcity of Algorithm that you will usethen optrmize the solution..

[algogeeks] Re: Simulation algo

2010-12-24 Thread pschaus
I don't think Ant-Colony-Optimization is related to Discrete Event Simulation. If you are looking for a framework to model DES, you may have look at SimPy http://simpy.sourceforge.net/ Cheers, Pierre On 24 déc, 04:29, Chi i...@chihoang.de wrote: Ant-Colony-Optimization - Ursprüngliche

[algogeeks] good question

2010-12-24 Thread monty 1987
Given a boolean matrix with all the true elements on left side in the row so that each row can be broken into two parts left part containing only true elements and right part containing only false elements. Find the row with max number of true elements in it. if the size of matrix is m*n then it

[algogeeks] Amazon Question

2010-12-24 Thread bittu
You have been given a Two Dimensional Array and One Dimensional Array.. You have to return true if 2D array consists of given 1D Array… 2D array Consists of 1D array means all the elements of 1d are present contiguously in left side, right side ,in up or in down directions in 2d array.. Regards

Re: [algogeeks] Re: amazon interview question

2010-12-24 Thread Soumya Prasad Ukil
O(m+n). Search from rightmost top corner. Count the no of zero from right and go to left, i.e. traverse through columns from right of the first row. When you find a column having 0, go down to lower row. Check the correspondent column is 1 or not. If it is, follow the above step or else go down to

Re: [algogeeks] matrix [MS]

2010-12-24 Thread Ashish Goel
this code has a problem for t[1][1] position when the value is 1(possible values 0/1 i.e. B/W) can fix tomorrow.. Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Fri, Dec 24, 2010 at 5:58 PM, Ashish Goel ashg...@gmail.com wrote: asnwer to

[algogeeks] Re: SUN Microsystem Question

2010-12-24 Thread Dave
@Bittu: Using the first 10 numbers, build a max heap. Then add each number into the 11th array position (always the 11th position) and perform the up-heap operation. At the end of the input, discard the 11th number in the heap. The remaining numbers will be the 10 maximum. O(n log k) where n = the

[algogeeks] Re: good question

2010-12-24 Thread Dave
@Monty: Use an alternating across and down algorithm: Set the current row = the first row While current row is not the last row Look across the current row for the first false Look down the column containing that first false for a true If no such row is found, break. // current row is

Re: [algogeeks] Re: amazon interview question

2010-12-24 Thread Senthilnathan Maadasamy
@SoumyaNice Solution. -- 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...@googlegroups.com. For more options,

[algogeeks] Codechef

2010-12-24 Thread Ankur Khurana
I have solved this problem , but i need test cases for this as it it giving WA in online judge. i dont want algo , but if anyone have solved this, please provide with some random test cases or one or two corner test cases. i will be greatful. http://www.codechef.com/problems/ARRAYTRM Given n

Re: [algogeeks] Re: good question

2010-12-24 Thread bhupendra dubey
@Dave nice algorithm On Fri, Dec 24, 2010 at 6:59 PM, Dave dave_and_da...@juno.com wrote: @Monty: Use an alternating across and down algorithm: Set the current row = the first row While current row is not the last row Look across the current row for the first false Look down the

Re: [algogeeks] SUN Microsystem Question

2010-12-24 Thread juver++
In addition - you should use 10 iterations of selection sort in each chunk. Then the same procedure for the group of chunks. -- 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

Re: [algogeeks] matrix [MS]

2010-12-24 Thread juver++
Incorrect, you tried to solve different problem. -- 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] Find a specific number in a special matrix.

2010-12-24 Thread yq Zhang
Suppose you have a matrix n*m. each column and row of the matrix is already sorted. For example: 1,2,3 2,3,4 4,5,6 All 3 rows and 3 columns of above matrix are sorted. How to find a specific number in the matrix? The trivial O(nlogm) solution is to use binary search for all rows. I am looking

[algogeeks] Interview question

2010-12-24 Thread MAC
Given a Binary Matrix of 0's and 1's. Write an algorithm to: 1) Print the largest Rectangular Sub-matrix with all 1's. 2)Print the largest Sub-matrix with all boundary elements 0. Explain your whole algorithm with an example. -- thanks --mac -- You received this message because you are

Re: [algogeeks] Find a specific number in a special matrix.

2010-12-24 Thread MAC
move from top rightmost column , go down if the number being searched is greater or left if the number being seracehd is small .. O(m+n) if u wanted to search 5 , u start from 3 (top right) , and since 53 , u go down to 4 , then 5 4 so go down , u reach 6 . now 5 6 so u will need to go left ..

Re: [algogeeks] Find a specific number in a special matrix.

2010-12-24 Thread yq Zhang
@mac, Nice solution! On Fri, Dec 24, 2010 at 7:13 PM, MAC macatad...@gmail.com wrote: move from top rightmost column , go down if the number being searched is greater or left if the number being seracehd is small .. O(m+n) if u wanted to search 5 , u start from 3 (top right) , and since 53 ,

Re: [algogeeks] random function

2010-12-24 Thread Puneet Ginoria
volume 2 , chapter 3 On Fri, Dec 24, 2010 at 11:13 AM, Puneet Ginoria punnu.gino...@gmail.comwrote: There is a book called The art of computer programming by donald knuth. He had discussed the random function in great detail. On Tue, Dec 21, 2010 at 8:06 PM, snehal jain

[algogeeks] UVA problems getting wrong answers

2010-12-24 Thread ankit sablok
hii at all i was solving an adhoc problem on uva judge link - http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8page=show_problemcategory=121problem=208mosmsg=Submission+received+with+ID+8477913 and hers my code for the problem but i get wrong answer every tme plzzz help me debug