for(int i=0;i<=n/2;i++)
{
for(int j=0;j<=i;j++)
{
a[i][j]=='*';
}
for(int j=i+1;j wrote:
>
>
> OK, I need to write an algorithm to populate a 2D array A(i,j) of size
> n x n. There is 1 '*' in the 1st row, increasing to n/2 in the middle
> row, this decreases back to 1'*' in the last row. We can a
You got it, praveen.
On Jan 24, 7:07 pm, "praveen Jain" <[EMAIL PROTECTED]> wrote:
> sorry my previous mail was incomplete
>
> according to my thinking this could be the solution.
> take the summation of both the element and compare it with either of the
> element if it is more then overflow won'
sorry my previous mail was incomplete
according to my thinking this could be the solution.
take the summation of both the element and compare it with either of the
element if it is more then overflow won't happen. if it is less it means
oveflow has happened.
Regards
Praveen
On 1/25/07, pravee
hi abid ,
I think this could be the solution.
if u take the summation of both the element and co
On 1/24/07, Abid <[EMAIL PROTECTED]> wrote:
>
>
> This is an interview question.
> What is the simples way to check if the sum of two unsigned integers
> has resulted in an overflow. ?
>
Well, consider the max unsigned value is MAX.
*if MAX-A > B then print "A + B will overflow."*
The trick is scalable to detecting multiplication overflow as well.
*if MAX/A > B then print "A x B will overflow."*
-Lego
On 1/24/07, Ming (Amos) Zhang <[EMAIL PROTECTED]> wrote:
>
> This is not co
This is not correct.
Given unsigned char A=255, B=1;
A+B overflows, but ur alg fail to detect it.
_
From: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Santhosh Suresh
Sent: Wednesday, January 24, 2007 8:02 AM
To: algogeeks@googlegroups.com
Subject: [algogee
OK, I need to write an algorithm to populate a 2D array A(i,j) of size
n x n. There is 1 '*' in the 1st row, increasing to n/2 in the middle
row, this decreases back to 1'*' in the last row. We can also assume
that n is odd.
*--
**-
***---
--
*-
--
***-
Not clear,
give the full explanation .
Sandesh Hegde
On Jan 24, 8:32 pm, "delboy" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to input the following values into a 2D array via some sort
> of method / algorithm. Any ideas on the best way to approach this?
>
> *--
>
Hi,
I'm trying to input the following values into a 2D array via some sort
of method / algorithm. Any ideas on the best way to approach this?
*--
**-
***---
--
*-
--
***---
**-
*--
Thanks,
Del
--~--~-~--~~
say, given the limit of the unsigned as k bits. Find log to base 2^k. If
it's one in both, it'll result in an overflow.
-- Forwarded message --
From: aravind kumar <[EMAIL PROTECTED]>
Date: Jan 24, 2007 7:10 PM
Subject: [algogeeks] Re: the sum of two unsigned integers
To: algogeeks
check if the sum is less than any of the two numbers that means the sum
resulted in a overflow.
On 1/24/07, Abid <[EMAIL PROTECTED]> wrote:
>
>
> This is an interview question.
> What is the simples way to check if the sum of two unsigned integers
> has resulted in an overflow. ?
>
>
> >
>
--
R
This is an interview question.
What is the simples way to check if the sum of two unsigned integers
has resulted in an overflow. ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to
Hi Minhaz
thnkx for help and pointing me to my mistake but now one thing i know
... is the number of points in the input will be distinct or there may
be some duplicate point . like suppose the input is like this...
9
0 1
0 2
1 2
1 3
2 3
3 3
3 0
1 0
1 1
now the output of this program will
(0 1)
Hi Minhaz
thnkx for help and pointing me to my mistake but now one thing i know
... is the number of points in the input will be distinct or there may
be some duplicate point . like suppose the input is like this...
9
0 1
0 2
1 2
1 3
2 3
3 3
3 0
1 0
1 1
now the output of this program will
(0 1
14 matches
Mail list logo