Re: [algogeeks] Re: rectangle of max sum MS Q

2012-01-17 Thread UTKARSH SRIVASTAV
yes good point pointed by atul it works only for positive numbers in matrix for negative numbers we have to consider maximum continuous sum for that row starting with that element On Tue, Jan 17, 2012 at 10:28 AM, atul anand atul.87fri...@gmail.comwrote: @UTKARSH : my approach is similar to

Re: [algogeeks] Re: Time Complexity Ques

2012-01-17 Thread atul anand
answer to this post has not yet been answered ...i.e abt complexity. seems log(n) to me.. correct me if i am wrong. On Mon, Jan 16, 2012 at 8:53 AM, Gene gene.ress...@gmail.com wrote: I'm sorry for not being specific. I meant it doesn't converge for all roots, e.g. cube root. On Jan 15,

[algogeeks] can anybody explain the output

2012-01-17 Thread him
/* test.c */ #include stdio.h #include ctype.h void fn(int x, int y); int main(void) { int a = 4; int b = -4; printf([%s, %s, %c]\n, \12 3, \123, \123); printf([a: %d, b: %d]\n, a-1, b1); printf(Mod variants: 5,3 [Q: %2d, R: %2d]\n, 5/3, 5%3); printf(Mod variants: -5,3 [Q: %2d, R:

[algogeeks] fork command confusion

2012-01-17 Thread himanshu kansal
#includestdio.h int main() { printf(hello); fork(); printf(world); } what will be the o/p on my system...its showing hello world hello world... but i think it could be hello world two times in any order. please tell me what is the exact o/p...

Re: [algogeeks] fork command confusion

2012-01-17 Thread Durgesh Kumar
#includestdio.h int main() { int i=0; printf(helllo world %d\n,i); i++; fork(); //Fork Exeution Starts from here . printf(hello forking %d\n,i); i++; } o/p:- helllo world 0 hello forking 1 hello forking 1 On 1/17/12, himanshu kansal

Re: [algogeeks] fork command confusion

2012-01-17 Thread Durgesh Kumar
#includestdio.h int main() { int i=0; printf(hello world \n); i++; fork(); printf(forking %d,i); i++; } o/p :- hello world Can any1 explain this?? On 1/17/12, Durgesh Kumar durgesh1...@gmail.com wrote: How can we join after the forking

Re: [algogeeks] fork command confusion

2012-01-17 Thread shady
On Tue, Jan 17, 2012 at 4:54 PM, Durgesh Kumar durgesh1...@gmail.comwrote: #includestdio.h int main() { int i=0; printf(hello world \n); i++; fork(); printf(forking %d,i); i++; } o/p :- hello world Can any1 explain this?? On 1/17/12,

Re: [algogeeks] fork command confusion

2012-01-17 Thread shady
answered by sunny. and output you mentioned is also wrong. search archives. On Tue, Jan 17, 2012 at 5:31 PM, shady sinv...@gmail.com wrote: On Tue, Jan 17, 2012 at 4:54 PM, Durgesh Kumar durgesh1...@gmail.comwrote: #includestdio.h int main() { int i=0; printf(hello world

Re: [algogeeks] algo qstn

2012-01-17 Thread Umer Farooq
0 On 1/16/12, Ravi Ranjan ravi.cool2...@gmail.com wrote: An ant moves on a regular grid of squares that are coloured either black or white. The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the

[algogeeks] Histogram rectangle

2012-01-17 Thread Ashish Goel
You are given an array which represents the heights of every bar of a histogram. Now all these bars are contiguous (juxtaposed wrt each other) and have the same width. For Example, A={2,1,4} represents a histogram having 3 bars of height 2,1and 4 in that order. Now you need to find a rectangle in

[algogeeks] Re: check Similar array

2012-01-17 Thread WgpShashank
@sravan . u missed man ..read again what i said , u r calculating 3^a[i] , where is 3 comes in to picture , no array has has 3 ?? correct , its should be 2^a[i] , then we search 2 in 2nd array if found 2 the go ahead, read the algo suggested above , its should work . let me know whats your

Re: [algogeeks] Re: sqrt function...

2012-01-17 Thread WgpShashank
@all Using Newton's method as described above, the time complexity of calculating a root of a function f(x) with n-digit precision, provided that a good initial approximation is known, is O((\log n) F(n)) where F(n) is the cost of calculating f(x)/f'(x)\, with n-digit precision. However,

Re: [algogeeks] Histogram rectangle

2012-01-17 Thread amrit harry
find the lowest height of the bar multiply it with the number of the bars in graph. it would be the minimum area. On Tue, Jan 17, 2012 at 5:33 PM, Ashish Goel ashg...@gmail.com wrote: You are given an array which represents the heights of every bar of a histogram. Now all these bars are

Re: [algogeeks] Histogram rectangle

2012-01-17 Thread amrit harry
sorry for last comment i misunderstand the problem. On Tue, Jan 17, 2012 at 5:54 PM, amrit harry dabbcomput...@gmail.comwrote: find the lowest height of the bar multiply it with the number of the bars in graph. it would be the minimum area. On Tue, Jan 17, 2012 at 5:33 PM, Ashish Goel

[algogeeks] 8 box question : MS

2012-01-17 Thread Ashish Goel
- || || - | ||| | ||| -- | ||| | ||| -- || || -- Set 1-8 in these 8 boxese such that consecutive numbers wont intersect vertically/horizontally or diagonally Set 1-8 in

Re: [algogeeks] Histogram rectangle

2012-01-17 Thread UTKARSH SRIVASTAV
read my reply on a post of maximum rectangle yesterday On 1/17/12, amrit harry dabbcomput...@gmail.com wrote: sorry for last comment i misunderstand the problem. On Tue, Jan 17, 2012 at 5:54 PM, amrit harry dabbcomput...@gmail.comwrote: find the lowest height of the bar multiply it with the

Re: [algogeeks] Histogram rectangle

2012-01-17 Thread Adolfo Ccanto
Can you explain the size of inputs? I think that Coordinate's Compression can solved this 2012/1/17 UTKARSH SRIVASTAV usrivastav...@gmail.com read my reply on a post of maximum rectangle yesterday On 1/17/12, amrit harry dabbcomput...@gmail.com wrote: sorry for last comment i misunderstand

[algogeeks] Re: check Similar array

2012-01-17 Thread sravanreddy001
@Shashank: can you look at the first post from you? you are calculating 3^a[i] adding it to the sum, can you write a pseudocode so that none of gets confused. (also, if you are saying this. for each element, raise element to the power of 2 (2^a[i]), (like you said in above post), or 3, like

[algogeeks] Re: Sorting for large data

2012-01-17 Thread sravanreddy001
I agree with Gene, 10^80 is of very larger magnitude, and is no way possible to solve given any amount of time, He might be testing you to '*think it practically before jumping to answer the question*' (or) he/you must have gone wrong somewhere. (even to read that input it takes for ever..)

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread Anika Jain
hey, does the question allows a consecutive number to lie at non adjacent vertical/horizontal/diagonal position?? On Tue, Jan 17, 2012 at 9:26 PM, atul anand atul.87fri...@gmail.com wrote: - || | 7 | - |4 || 3 | | | 1 || -- |

Re: [algogeeks] Re: check Similar array

2012-01-17 Thread atul anand
@ WgpShashank : considering your latest comment abt you algo... /* i didn't get how my approach will fail , can u check for the exmple u said ? if u sum the 1st array using 2 as base then sum will be 3 (*exculding 2 , although it won't metter* ) , then u search that elemnt in 2nd array , u

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread atul anand
@anika : i guess.if your concern is allowed then i dont think so we can solve this problem. On Tue, Jan 17, 2012 at 9:59 PM, Anika Jain anika.jai...@gmail.com wrote: hey, does the question allows a consecutive number to lie at non adjacent vertical/horizontal/diagonal position?? On Tue,

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread Anika Jain
@atul: yes i agree with you.. hmm.. On Tue, Jan 17, 2012 at 10:21 PM, atul anand atul.87fri...@gmail.comwrote: @anika : i guess.if your concern is allowed then i dont think so we can solve this problem. On Tue, Jan 17, 2012 at 9:59 PM, Anika Jain anika.jai...@gmail.comwrote: hey, does

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread atul anand
btw no need to solve this problem using hit and trial... idea here is from 1-8 , 1 and 8 are only number whose adjacent elements are 1(1 adjacent 2 , 8 has adjacent 7). whereas rest of the element has 2 adjacent element so it would be best to keep 1,8 bcozz they are the only elements who has only

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread atul anand
correction above: so it would be best to keep 1,8 at center. On Tue, Jan 17, 2012 at 10:36 PM, atul anand atul.87fri...@gmail.comwrote: btw no need to solve this problem using hit and trial... idea here is from 1-8 , 1 and 8 are only number whose adjacent elements are 1(1 adjacent 2 , 8 has

Re: [algogeeks] Binary Index Tree

2012-01-17 Thread Anil Arya
Questions on BIT http://problemclassifier.appspot.com/index.jsp?search=BITusr= want questions on segment tree http://problemclassifier.appspot.com/index.jsp?search=treeusr= On Sun, Jan 15, 2012 at 7:58 PM, Amol Sharma amolsharm...@gmail.com wrote: also try

[algogeeks] Re: algo qstn

2012-01-17 Thread jaimedp
120 On Jan 17, 5:59 am, Umer Farooq the.um...@gmail.com wrote: 0 On 1/16/12, Ravi Ranjan ravi.cool2...@gmail.com wrote: An ant moves on a regular grid of squares that are coloured either black or white. The ant is always oriented in one of the cardinal directions (left, right,

[algogeeks] Re: algo qstn

2012-01-17 Thread Don
+1 Jaimedp On Jan 17, 1:05 pm, jaimedp jaim...@gmail.com wrote: 120 On Jan 17, 5:59 am, Umer Farooq the.um...@gmail.com wrote: 0 On 1/16/12, Ravi Ranjan ravi.cool2...@gmail.com wrote: An ant moves on a regular grid of squares that are coloured either black or white. The

Re: [algogeeks] rectangle of max sum MS Q

2012-01-17 Thread sravanreddy001
Hi atul: Can u give the complexity for ur algorithm. I think of an O(m^2n^2) =~ O(n^4) algorithm, with constant space. The kadane's algo should be applied on a 2-d data right.. that takes the complexity to order of 2. -- You received this message because you are subscribed to the Google

Re: [algogeeks] rectangle of max sum MS Q

2012-01-17 Thread atul anand
@sravanreddy001 : complexity would be : O(R^2 * C) where R and C are no. of rows and column respectively. On Wed, Jan 18, 2012 at 9:30 AM, sravanreddy001 sravanreddy...@gmail.comwrote: Hi atul: Can u give the complexity for ur algorithm. I think of an O(m^2n^2) =~ O(n^4) algorithm, with

Re: [algogeeks] Re: Time Complexity Ques

2012-01-17 Thread sravanreddy001
@atul: on the first look, even I thought the same.. O(log N).. and this is may be true for the given precision. *[-- the following may not be related to given qn.] -- but.. can u comment on this view point..* but.. I am thinking that, the complexity is dependent on the level of precision

Re: [algogeeks] fork command confusion

2012-01-17 Thread sravanreddy001
@himanshu: from the line after fork(). (as I assume, even the program counter is copied with the same value.) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] rectangle of max sum MS Q

2012-01-17 Thread atul anand
@sravanreddy001 : and kadane algo will be applied to each row. after finding cumulative sum. at each row , apply kadane algo (here we are considering that matrix could be anywhere starting from row=0 i.e it can be b/w row = 0 to row=1 or row =0 to row=2 , row=0 to row=3...etc ). find maxsum and

Re: [algogeeks] Re: check Similar array

2012-01-17 Thread WgpShashank
@atul.. let me tell you ., i told that we can send u took two array arr[]={2,0,0,0} arr2[]={2,-2,1,0}; take 2 as a base in 1st array , calculate sum (exclduing 2 ), calculate base^arr[i] that gives sum1= 3 sorting not allowed , just search linearly 2 in 2nd array e.g. search the same