@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 elem
@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 u
@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
https://groups.google.com/d/msg/algogeeks
@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 requir
@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 wrote:
> 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.
>
> Th
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 Group
+1 Jaimedp
On Jan 17, 1:05 pm, jaimedp wrote:
> 120
>
> On Jan 17, 5:59 am, Umer Farooq wrote:
>
>
>
> > 0
>
> > On 1/16/12, Ravi Ranjan 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
120
On Jan 17, 5:59 am, Umer Farooq wrote:
> 0
>
> On 1/16/12, Ravi Ranjan 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
Questions on BIT
http://problemclassifier.appspot.com/index.jsp?search=BIT&usr=
want questions on segment tree
http://problemclassifier.appspot.com/index.jsp?search=tree&usr=
On Sun, Jan 15, 2012 at 7:58 PM, Amol Sharma wrote:
> also try
>
> http://www.spoj.pl/problems
correction above:
so it would be best to keep 1,8 at center.
On Tue, Jan 17, 2012 at 10:36 PM, atul anand wrote:
> 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).
> where
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
@atul: yes i agree with you.. hmm..
On Tue, Jan 17, 2012 at 10:21 PM, atul anand wrote:
> @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 wrote:
>
>> hey, does the question allows a consecutive num
@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 wrote:
> hey, does the question allows a consecutive number to lie at non adjacent
> vertical/horizontal/diagonal position??
>
>
> On Tue, Jan 17, 2012 at 9
@ 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
won;
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 wrote:
> -
> ||
> | 7 |
> -
> |4 || 3 |
> | | 1 ||
> --
> | |||
>
-
||
| 7 |
-
|4 || 3 |
| | 1 ||
--
| |||
|6 | 8 | 5 |
--
| 2 |
||
On Tue, Jan 17, 2012 at 6:20 PM, Ashish Goel wrote:
>
>
> -
> ||
> ||
> -
> | |||
>
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..)
--
@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
Can you explain the size of inputs?
I think that Coordinate's Compression can solved this
2012/1/17 UTKARSH SRIVASTAV
> read my reply on a post of maximum rectangle yesterday
>
> On 1/17/12, amrit harry wrote:
> > sorry for last comment i misunderstand the problem.
> >
> > On Tue, Jan 17, 2012
read my reply on a post of maximum rectangle yesterday
On 1/17/12, amrit harry wrote:
> sorry for last comment i misunderstand the problem.
>
> On Tue, Jan 17, 2012 at 5:54 PM, amrit harry wrote:
>
>> find the lowest height of the bar multiply it with the number of the bars
>> in graph. it would
-
||
||
-
| |||
| |||
--
| |||
| |||
--
||
||
--
Set 1-8 in these 8 boxese such that consecutive numbers wont intersect
vertically/horizontally or diagonally
Set 1-8 in t
sorry for last comment i misunderstand the problem.
On Tue, Jan 17, 2012 at 5:54 PM, amrit harry wrote:
> 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 wrote:
>
>> You are giv
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 wrote:
> You are given an array which represents the heights of every bar of a
> histogram. Now all these bars are contiguous (juxtaposed
@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, depe
@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
con
question: from where the execution of fork command starts?
i have searched the archives...but its not there
On Tue, Jan 17, 2012 at 5:31 PM, shady wrote:
> answered by sunny. and output you mentioned is also wrong. search archives.
>
>
> On Tue, Jan 17, 2012 at 5:31 PM, shady wrote:
>
0
On 1/16/12, Ravi Ranjan 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
> following rules:
> - if it
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 t
answered by sunny. and output you mentioned is also wrong. search archives.
On Tue, Jan 17, 2012 at 5:31 PM, shady wrote:
>
>
> On Tue, Jan 17, 2012 at 4:54 PM, Durgesh Kumar wrote:
>
>> #include
>>
>> int main()
>> {
>>int i=0;
>> printf("hello world \n");
>>i++;
>>
On Tue, Jan 17, 2012 at 4:54 PM, Durgesh Kumar wrote:
> #include
>
> 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 K
#include
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 wrote:
> How can we join after the forking
>
> On 1/17/12, Durg
How can we join after the forking
On 1/17/12, Durgesh Kumar wrote:
> #include
>
> 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++;
>
> }
>
#include
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 wrote
that is because output is buffered.
when printf("hello") is executed, "hello" goes to the output buffer and it
waits for a new line
after fork there will be two instances of the program and both will output
"helloworld"
try putting a new line in the first printf statement, you will get expected
out
#include
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...
i h
/* test.c */
#include
#include
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, b>>1);
printf("Mod variants: 5,3 [Q: %2d, R: %2d]\n", 5/3, 5%3);
printf("Mod variants: -5,3 [Q: %2d
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 wrote:
> I'm sorry for not being specific. I meant it doesn't converge for all
> roots, e.g. cube root.
>
> On Jan 15, 10:18 pm, Dave wrote
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 wrote:
> @UTKARSH :
>
> my approach is similar to yours written above.
38 matches
Mail list logo