[algogeeks] Re: C floating point issue....

2011-06-04 Thread T3rminal
@nicks
K&R says
"A warning: printf uses its first argument to decide how many
arguments follow and what their type are. It will get confused and you
will get wrong answer. if there are not enough arguments or if they
are the wrong types."
I think that is the reason for unpredictable output.
On Jun 5, 9:08 am, nicks  wrote:
> read how the floating numbers are stored in memory it will help
>
> i understood the most except this ---
>
>      float p=4.5;
>     printf("\n%f,%d",p,p);
>
> *output -
> *4.50,0
>
> and if we use
>  printf("\n%d,%f",p,p);
>
> *output -
> *0,0.0
>
> i want to know why just changing the order of %d and %f is changing the
> output..plz help !!
>
>
>
>
>
>
>
> On Sat, Jun 4, 2011 at 12:13 PM, Anika Jain  wrote:
> > read ch1 in understanding pointers in c by kanetkar.. it says tht if u use
> > %d format specifier to print a float an unknown value will come.. and if use
> > %f to print an integer then also unknown value will come.. so u r not
> > supposed to switch format specifiers like this
>
> > On Sun, Jun 5, 2011 at 12:33 AM, Rohit Sindhu <
> > rohit.sindhu.spec...@gmail.com> wrote:
>
> >> Your format specifiers in the printf statements are not right.
> >> Also integers and floats are stored differently internally. Also, you have
> >> to explicitly cast float into int as automatic conversion is not applicable
> >> here in printf.
>
> >> I hope this code helps your cause ,
>
> >> #include
>
> >> int main()
> >> {
> >>     float a[]={13.24,1.5,1.5,5.4,3.5};
> >>     float *j;
> >>     j=a;
> >>     j=j+4;
> >>     printf("\n%p,%f,%f",j,*j,a[4]);
>
> >>     float p=3.5;
> >>     printf("\n%f,%d",p,(int)p);
>
> >>     p=4.5;
> >>     printf("\n%d,%f",(int)p,p);
>
> >> }
>
> >> On Sat, Jun 4, 2011 at 2:21 PM, himanshi narang <
> >> himanshinarang...@gmail.com> wrote:
>
> >>> #include
>
> >>> int main()
> >>> {
> >>>     float a[]={13.24,1.5,1.5,5.4,3.5};
> >>>     float *j;
> >>>     j=a;
> >>>     j=j+4;
> >>>     printf("\n%d,%d,%d",j,*j,a[4]);
>
> >>>     float p=3.5;
> >>>     printf("\n%f,%d",p,p);
>
> >>>     p=4.5;
> >>>     printf("\n%d,%f",p,p);
>
> >>> }
>
> >>> output
> >>> -1080027596,0,1074528256
> >>> 3.50,0
> >>> 0,0.00
>
> >>> plzz explain y i m getting dis output..
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >> --
> >> Rohit Sindhu
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread Vishal Thanki
http://www.yolinux.com/TUTORIALS/GDB-Commands.html

this may help

On Sat, Jun 4, 2011 at 11:57 PM, nitish goyal  wrote:
> @ saurabh singh
> thanks
>
> On Sat, Jun 4, 2011 at 11:44 PM, saurabh singh 
> wrote:
>>
>> Do man gdb
>>
>> On Sat, Jun 4, 2011 at 11:20 PM, rahul  wrote:
>>>
>>> gdb a.out
>>> b(break) main .
>>> den do press n(next) to execute next stmt.
>>> if next instruction is function...
>>> press s(step).
>>>
>>>
>>>
>>> On Sat, Jun 4, 2011 at 11:19 PM, nitish goyal 
>>> wrote:

 n ?

 do not understand it.
 Please elaborate

 On Sat, Jun 4, 2011 at 11:17 PM, rahul  wrote:
>
> n
>
> On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal 
> wrote:
>>
>> Please tell me the commands to use the gdb debugger
>>
>> To run the code line by line
>>
>> --
>> Regards,
>> Nitish Goyal
>> Undergraduate Student Of NSIT,
>> Computer Engineering (B.E.)
>> Asst. PlaceComm 2011
>> contact me:- +91-605824
>> Reply at :-  nitishgoyal.n...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.



 --
 Regards,
 Nitish Goyal
 Undergraduate Student Of NSIT,
 Computer Engineering (B.E.)
 Asst. PlaceComm 2011
 contact me:- +91-605824
 Reply at :-  nitishgoyal.n...@gmail.com

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>>
>> --
>> Thanks & Regards,
>> Saurabh
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>
>
>
> --
> Regards,
> Nitish Goyal
> Undergraduate Student Of NSIT,
> Computer Engineering (B.E.)
> Asst. PlaceComm 2011
> contact me:- +91-605824
> Reply at :-  nitishgoyal.n...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SPOJ ETF

2011-06-04 Thread keyan karthi
first time when i pre processed, my code timed out :P on calling it for
every loop iteration my code passed !! may be tats the problem...

On Sun, Jun 5, 2011 at 1:56 AM, kartik sachan wrote:

> @arun.i got nothing from this link becoz i have made the
> program from that concept...give me some other hints..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread Harshal
On Sun, Jun 5, 2011 at 9:59 AM, nicks  wrote:

> that's what i said changing the order of %f and %d is changing the output
> in the 3rd printf.if you put %f before the %d then it gives you the
> expected output.
>
>
> On Sat, Jun 4, 2011 at 9:10 PM, himanshi narang <
> himanshinarang...@gmail.com> wrote:
>
>> actualy i want to knw dat if i m using integer format for printing a
>> floating point number den for *j it is giving 0 but for a[4] its giving some
>> value
>>
>> but as u guys says it give unknwn value..den fyn..
>>
>> but in 3rd printf wen i am giving integer format before float format its
>> giving me 0 n 0.00.. why not its printing 4.50 for floating point
>> format.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Harshal Choudhary,
III Year B.Tech CSE,
NIT Surathkal, Karnataka, India.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread nicks
that's what i said changing the order of %f and %d is changing the output in
the 3rd printf.if you put %f before the %d then it gives you the
expected output.

On Sat, Jun 4, 2011 at 9:10 PM, himanshi narang  wrote:

> actualy i want to knw dat if i m using integer format for printing a
> floating point number den for *j it is giving 0 but for a[4] its giving some
> value
>
> but as u guys says it give unknwn value..den fyn..
>
> but in 3rd printf wen i am giving integer format before float format its
> giving me 0 n 0.00.. why not its printing 4.50 for floating point
> format.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c output

2011-06-04 Thread nicks
i agree this type of expressions are not defined and are depend on the
machine..
it's something like a[i]=i++;
the result may vary from machine to machine !

On Sat, Jun 4, 2011 at 5:00 PM, Rohit Sindhu  wrote:

>
> 1. If the operand values is to be stored in temporaries the first
> evaluation will make one operand to be 4 and next evaluation make
> the other one to be 5. So in this case the result is  4*5 = 20.
>
> 2. But if variable b is to be used as operands the result will be 5*5 = 25
>
>
> As a good practice using sub

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread himanshi narang
actualy i want to knw dat if i m using integer format for printing a
floating point number den for *j it is giving 0 but for a[4] its giving some
value

but as u guys says it give unknwn value..den fyn..

but in 3rd printf wen i am giving integer format before float format its
giving me 0 n 0.00.. why not its printing 4.50 for floating point
format.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread nicks
read how the floating numbers are stored in memory it will help


i understood the most except this ---


 float p=4.5;
printf("\n%f,%d",p,p);

*output -
*4.50,0

and if we use
 printf("\n%d,%f",p,p);

*output -
*0,0.0

i want to know why just changing the order of %d and %f is changing the
output..plz help !!


On Sat, Jun 4, 2011 at 12:13 PM, Anika Jain  wrote:

> read ch1 in understanding pointers in c by kanetkar.. it says tht if u use
> %d format specifier to print a float an unknown value will come.. and if use
> %f to print an integer then also unknown value will come.. so u r not
> supposed to switch format specifiers like this
>
>
> On Sun, Jun 5, 2011 at 12:33 AM, Rohit Sindhu <
> rohit.sindhu.spec...@gmail.com> wrote:
>
>> Your format specifiers in the printf statements are not right.
>> Also integers and floats are stored differently internally. Also, you have
>> to explicitly cast float into int as automatic conversion is not applicable
>> here in printf.
>>
>> I hope this code helps your cause ,
>>
>> #include
>>
>> int main()
>> {
>> float a[]={13.24,1.5,1.5,5.4,3.5};
>> float *j;
>> j=a;
>> j=j+4;
>> printf("\n%p,%f,%f",j,*j,a[4]);
>>
>> float p=3.5;
>> printf("\n%f,%d",p,(int)p);
>>
>> p=4.5;
>> printf("\n%d,%f",(int)p,p);
>>
>>
>> }
>>
>>
>>
>>
>>
>>
>> On Sat, Jun 4, 2011 at 2:21 PM, himanshi narang <
>> himanshinarang...@gmail.com> wrote:
>>
>>> #include
>>>
>>> int main()
>>> {
>>> float a[]={13.24,1.5,1.5,5.4,3.5};
>>> float *j;
>>> j=a;
>>> j=j+4;
>>> printf("\n%d,%d,%d",j,*j,a[4]);
>>>
>>> float p=3.5;
>>> printf("\n%f,%d",p,p);
>>>
>>> p=4.5;
>>> printf("\n%d,%f",p,p);
>>>
>>> }
>>>
>>>
>>> output
>>> -1080027596,0,1074528256
>>> 3.50,0
>>> 0,0.00
>>>
>>> plzz explain y i m getting dis output..
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Rohit Sindhu
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c output

2011-06-04 Thread Rohit Sindhu
Order of evaluation of operands is not defined in C and secondly the result
will be compiler implementation dependent.  A compiler may store the sub
expressions operand values in a temporary storage or can make use of
variable value as an operand.

*In each case, either of the ++b may be executed first. *

1. If the operand values is to be stored in temporaries the first evaluation
will make one operand to be 4 and next evaluation make
the other one to be 5. So in this case the result is  4*5 = 20.

2. But if variable b is to be used as operands the result will be 5*5 = 25


As a good practice using sub expressions which modify same data object
should be avoided in an expression.



On Sat, Jun 4, 2011 at 2:23 PM, Dv!! ITs nt me now!! <
sunny.verma...@gmail.com> wrote:

>  statement  starts executing from the right side!!! 1st it reads it
> from left !! while reading b increment two times and new value of b is
> thn 5 nw it gets executed!!!
> am i right??
>
> On 6/4/11, hary rathor  wrote:
> > in 1st pass
> >
> > both ++b
> > ++b= 4 then ++b= 5;
> >
> > at second pass a= 5*5; because ++b is 5
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
> Dhruva Verma
> BTech(IT)-2nd year
> IIIT-Allahabad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
ROHIT SINDHU
B.Tech (IT) -- 6th sem.
INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, ALLAHABAD.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SPOJ ETF

2011-06-04 Thread kartik sachan
@arun.i got nothing from this link becoz i have made the program
from that concept...give me some other hints..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread Anika Jain
read ch1 in understanding pointers in c by kanetkar.. it says tht if u use
%d format specifier to print a float an unknown value will come.. and if use
%f to print an integer then also unknown value will come.. so u r not
supposed to switch format specifiers like this

On Sun, Jun 5, 2011 at 12:33 AM, Rohit Sindhu <
rohit.sindhu.spec...@gmail.com> wrote:

> Your format specifiers in the printf statements are not right.
> Also integers and floats are stored differently internally. Also, you have
> to explicitly cast float into int as automatic conversion is not applicable
> here in printf.
>
> I hope this code helps your cause ,
>
> #include
>
> int main()
> {
> float a[]={13.24,1.5,1.5,5.4,3.5};
> float *j;
> j=a;
> j=j+4;
> printf("\n%p,%f,%f",j,*j,a[4]);
>
> float p=3.5;
> printf("\n%f,%d",p,(int)p);
>
> p=4.5;
> printf("\n%d,%f",(int)p,p);
>
>
> }
>
>
>
>
>
>
> On Sat, Jun 4, 2011 at 2:21 PM, himanshi narang <
> himanshinarang...@gmail.com> wrote:
>
>> #include
>>
>> int main()
>> {
>> float a[]={13.24,1.5,1.5,5.4,3.5};
>> float *j;
>> j=a;
>> j=j+4;
>> printf("\n%d,%d,%d",j,*j,a[4]);
>>
>> float p=3.5;
>> printf("\n%f,%d",p,p);
>>
>> p=4.5;
>> printf("\n%d,%f",p,p);
>>
>> }
>>
>>
>> output
>> -1080027596,0,1074528256
>> 3.50,0
>> 0,0.00
>>
>> plzz explain y i m getting dis output..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Rohit Sindhu
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C floating point issue....

2011-06-04 Thread Rohit Sindhu
Your format specifiers in the printf statements are not right.
Also integers and floats are stored differently internally. Also, you have
to explicitly cast float into int as automatic conversion is not applicable
here in printf.

I hope this code helps your cause ,

#include

int main()
{
float a[]={13.24,1.5,1.5,5.4,3.5};
float *j;
j=a;
j=j+4;
printf("\n%p,%f,%f",j,*j,a[4]);

float p=3.5;
printf("\n%f,%d",p,(int)p);

p=4.5;
printf("\n%d,%f",(int)p,p);

}






On Sat, Jun 4, 2011 at 2:21 PM, himanshi narang  wrote:

> #include
>
> int main()
> {
> float a[]={13.24,1.5,1.5,5.4,3.5};
> float *j;
> j=a;
> j=j+4;
> printf("\n%d,%d,%d",j,*j,a[4]);
>
> float p=3.5;
> printf("\n%f,%d",p,p);
>
> p=4.5;
> printf("\n%d,%f",p,p);
>
> }
>
>
> output
> -1080027596,0,1074528256
> 3.50,0
> 0,0.00
>
> plzz explain y i m getting dis output..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Rohit Sindhu

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: C floating point issue....

2011-06-04 Thread Dave
@Himanshi: Seeing as how you are printing memory addresses and floats
with a double format, what output are you expecting?

Dave

On Jun 4, 1:21 pm, himanshi narang 
wrote:
> #include
>
> int main()
> {
>     float a[]={13.24,1.5,1.5,5.4,3.5};
>     float *j;
>     j=a;
>     j=j+4;
>     printf("\n%d,%d,%d",j,*j,a[4]);
>
>     float p=3.5;
>     printf("\n%f,%d",p,p);
>
>     p=4.5;
>     printf("\n%d,%f",p,p);
>
> }
>
> output
> -1080027596,0,1074528256
> 3.50,0
> 0,0.00
>
> plzz explain y i m getting dis output..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Read a data from given particular memory location in C++

2011-06-04 Thread nicks
i wasn't able to think of other method but why are you using cout<<(void
*)p; for dereferencing.
cout<<*x is working to find to the value at memory ocation x.

On Sat, Jun 4, 2011 at 3:09 AM, Navneet Gupta  wrote:

> Can't think of any trivial/straight forward way of doing that other
> than dereferencing pointer.
>
> On Sat, Jun 4, 2011 at 3:34 PM, D.N.Vishwakarma@IITR 
> wrote:
> > I'm saying that int *x=new int(3); is a statement .
> > I want to find value at location allocated by new which is 3 in this case
> by
> > indirect way ... without use of (void*)x.
> >
> > On Sat, Jun 4, 2011 at 3:23 PM, Navneet  wrote:
> >>
> >> Sorry but the context is not very clear. What exactly are you trying
> >> to do?
> >> Looks like you want to allocate space for an integer value and assign
> >> the value p to it.
> >> So, you need to refer it with some pointer (in this case x).
> >>
> >>
> >> On Jun 4, 2:24 pm, "D.N.Vishwakarma@IITR "  wrote:
> >> > say memory location is 0x33f070  of int *x=new int(p);
> >> >  p is some value at that location. we have to find p  at that location
> >> > using
> >> > some indirect way...
> >> > without using cout<<(void*x); Is there any other way to find p?
> >> >
> >> > --
> >> > **With Regards
> >> > Deoki Nandan Vishwakarma
> >> > IITR MCA
> >> > Mathematics Department*
> >> > *
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> >
> >
> > --
> > With Regards
> > Deoki Nandan Vishwakarma
> > IITR MCA
> > Mathematics Department
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
>
>
> --
> --Navneet
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread nitish goyal
@ saurabh singh
thanks

On Sat, Jun 4, 2011 at 11:44 PM, saurabh singh wrote:

> Do man gdb
>
>
> On Sat, Jun 4, 2011 at 11:20 PM, rahul  wrote:
>
>> gdb a.out
>> b(break) main .
>> den do press n(next) to execute next stmt.
>> if next instruction is function...
>> press s(step).
>>
>>
>>
>>
>> On Sat, Jun 4, 2011 at 11:19 PM, nitish goyal wrote:
>>
>>> n ?
>>>
>>> do not understand it.
>>> Please elaborate
>>>
>>>
>>> On Sat, Jun 4, 2011 at 11:17 PM, rahul  wrote:
>>>
 n

 On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal 
 wrote:

> Please tell me the commands to use the gdb debugger
>
> To run the code line by line
>
> --
> Regards,
> Nitish Goyal
> Undergraduate Student Of NSIT,
> Computer Engineering (B.E.)
> Asst. PlaceComm 2011
> contact me:- +91-605824
> Reply at :-  nitishgoyal.n...@gmail.com
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards,
>>> Nitish Goyal
>>> Undergraduate Student Of NSIT,
>>> Computer Engineering (B.E.)
>>> Asst. PlaceComm 2011
>>> contact me:- +91-605824
>>> Reply at :-  nitishgoyal.n...@gmail.com
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks & Regards,
> Saurabh
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Nitish Goyal
Undergraduate Student Of NSIT,
Computer Engineering (B.E.)
Asst. PlaceComm 2011
contact me:- +91-605824
Reply at :-  nitishgoyal.n...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C floating point issue....

2011-06-04 Thread himanshi narang
#include

int main()
{
float a[]={13.24,1.5,1.5,5.4,3.5};
float *j;
j=a;
j=j+4;
printf("\n%d,%d,%d",j,*j,a[4]);

float p=3.5;
printf("\n%f,%d",p,p);

p=4.5;
printf("\n%d,%f",p,p);

}


output
-1080027596,0,1074528256
3.50,0
0,0.00

plzz explain y i m getting dis output..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread saurabh singh
Do man gdb

On Sat, Jun 4, 2011 at 11:20 PM, rahul  wrote:

> gdb a.out
> b(break) main .
> den do press n(next) to execute next stmt.
> if next instruction is function...
> press s(step).
>
>
>
>
> On Sat, Jun 4, 2011 at 11:19 PM, nitish goyal wrote:
>
>> n ?
>>
>> do not understand it.
>> Please elaborate
>>
>>
>> On Sat, Jun 4, 2011 at 11:17 PM, rahul  wrote:
>>
>>> n
>>>
>>> On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal wrote:
>>>
 Please tell me the commands to use the gdb debugger

 To run the code line by line

 --
 Regards,
 Nitish Goyal
 Undergraduate Student Of NSIT,
 Computer Engineering (B.E.)
 Asst. PlaceComm 2011
 contact me:- +91-605824
 Reply at :-  nitishgoyal.n...@gmail.com


  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Nitish Goyal
>> Undergraduate Student Of NSIT,
>> Computer Engineering (B.E.)
>> Asst. PlaceComm 2011
>> contact me:- +91-605824
>> Reply at :-  nitishgoyal.n...@gmail.com
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks & Regards,
Saurabh

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS Iv Question

2011-06-04 Thread hary rathor
 the area points ,  boundary on which circle need to display
 and radius should not be negative

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread rahul
gdb a.out
b(break) main .
den do press n(next) to execute next stmt.
if next instruction is function...
press s(step).




On Sat, Jun 4, 2011 at 11:19 PM, nitish goyal wrote:

> n ?
>
> do not understand it.
> Please elaborate
>
>
> On Sat, Jun 4, 2011 at 11:17 PM, rahul  wrote:
>
>> n
>>
>> On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal wrote:
>>
>>> Please tell me the commands to use the gdb debugger
>>>
>>> To run the code line by line
>>>
>>> --
>>> Regards,
>>> Nitish Goyal
>>> Undergraduate Student Of NSIT,
>>> Computer Engineering (B.E.)
>>> Asst. PlaceComm 2011
>>> contact me:- +91-605824
>>> Reply at :-  nitishgoyal.n...@gmail.com
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards,
> Nitish Goyal
> Undergraduate Student Of NSIT,
> Computer Engineering (B.E.)
> Asst. PlaceComm 2011
> contact me:- +91-605824
> Reply at :-  nitishgoyal.n...@gmail.com
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread nitish goyal
n ?

do not understand it.
Please elaborate

On Sat, Jun 4, 2011 at 11:17 PM, rahul  wrote:

> n
>
> On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal wrote:
>
>> Please tell me the commands to use the gdb debugger
>>
>> To run the code line by line
>>
>> --
>> Regards,
>> Nitish Goyal
>> Undergraduate Student Of NSIT,
>> Computer Engineering (B.E.)
>> Asst. PlaceComm 2011
>> contact me:- +91-605824
>> Reply at :-  nitishgoyal.n...@gmail.com
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Nitish Goyal
Undergraduate Student Of NSIT,
Computer Engineering (B.E.)
Asst. PlaceComm 2011
contact me:- +91-605824
Reply at :-  nitishgoyal.n...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] gcc debugger

2011-06-04 Thread rahul
n

On Sat, Jun 4, 2011 at 11:16 PM, nitish goyal wrote:

> Please tell me the commands to use the gdb debugger
>
> To run the code line by line
>
> --
> Regards,
> Nitish Goyal
> Undergraduate Student Of NSIT,
> Computer Engineering (B.E.)
> Asst. PlaceComm 2011
> contact me:- +91-605824
> Reply at :-  nitishgoyal.n...@gmail.com
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] gcc debugger

2011-06-04 Thread nitish goyal
Please tell me the commands to use the gdb debugger

To run the code line by line

-- 
Regards,
Nitish Goyal
Undergraduate Student Of NSIT,
Computer Engineering (B.E.)
Asst. PlaceComm 2011
contact me:- +91-605824
Reply at :-  nitishgoyal.n...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS question

2011-06-04 Thread hary rathor
" [ ] meas addtion " is  addition is base address  so 3 +"Ya!Hello! how is
this? %s\n"
 become "Hello! how is this? %s\n" cause of add 3 in base address in
followed  string ;
 this result as format specifier in printf funcution ;  same as for second
perameter ;
5+"junk/super" become "super"  string reson is same s above;

statment 2:

3+ "WHAT%c%c%c  %c%c  %c !\n"  is  "T%c%c%c  %c%c  %c !\n"is format
specifier  print "T"
1+"this" become  "his"   thereby print T form first orgument and 'h ' from
2nd orgument  cause of %c ; "Th"
2+"beauty" is become "auty"  and it will print 'a' cause of %c :
"Tha"
0+"tool" is "tool"  will print 't' cause of %c
  "That"
0+"is"  become "is"will print 'i' cuase of %c :
 "That i"
3+"sensitive"  result "sitive"  will print 's' reson again same %c
 "That is"
4+"CC"  result "CC" so it print 'C' cause of %c
  " That is C"


hence it printing this result :


i hope your query is now clear

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] box packing

2011-06-04 Thread hary rathor
then u can use radix sort ...

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: SPOJ problem- TRICOUNT

2011-06-04 Thread Dave
Also http://www.mathematik.uni-bielefeld.de/~sillke/SEQUENCES/grid-triangles.

Dave

On Jun 4, 8:28 am, Anirudh S  wrote:
> I am still working on arriving at a recursive solution but these links might
> help.
>
> http://mathworld.wolfram.com/TriangleTiling.html
> http://oeis.org/A002717
> 
>
>
>
> On Mon, Mar 21, 2011 at 5:50 PM, cegprakash  wrote:
> > hello... someone plz tell me how to arrive @ that formula..
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] box packing

2011-06-04 Thread NIKHIL JAIN
but is my logic correct i have tried it for some cases

On Sat, Jun 4, 2011 at 4:20 PM, Vipul Kumar  wrote:

> For rotation case, take all the orientation of a box in account and
> now apply the same algo
>
> On Sat, Jun 4, 2011 at 3:13 PM, Piyush Sinha 
> wrote:
> > For the rotation case, sort on the basis of volume...
> >
> > On 6/4/11, NIKHIL  wrote:
> >> given the boxes with dimentions in form (L,B,H)
> >> find the sequence in which the boxes can be stored inside the other.
> >>
> >> for eg.
> >>
> >> a=4,4,5
> >> b=3,4,3
> >> c=3,4,6
> >> d=2,3,2
> >>
> >> a(b(d))
> >> without rotation :
> >> is this correct logic
> >>
> >> sort on the basis of length and breadth and height
> >> then find lis on the basis of height starting from the bottom most box
> >> in the sorted sequence
> >>
> >> what for rotation case
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >>
> >
> >
> > --
> > *Piyush Sinha*
> > *IIIT, Allahabad*
> > *+91-8792136657*
> > *+91-7483122727*
> > *https://www.facebook.com/profile.php?id=10655377926 *
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Google Question

2011-06-04 Thread bittu
i also thought its relative to database but ultimately  it also
depends on the data structure & Algorithms used by database to
implement the particularly query.
The simpler implementation of this service is to store, in a database
table, a data pair (id, url) where your id has the autoincrement
option, e.g.

1 -> www.facebook.com
2 -> www.otherurl.com/path/complete/to/the/page.php
3 -> ... so on

So when a user ask for http://tinyurlservice.com/1 you simply do a
select into your table (select url from urlstable where id = '1') and
then you do a redirect to that url.

You could refine this, looking before if a certain url was already
'tinyurled' (so you prevent multiple insertions of the same url), you
could add a date field in your table and delete the older entries with
a stored procedure or with a cronjob or with an admin panel... and so
on.

1 have another approach using temp. array of all chars that a url can
contains  will explorer later..

Hope this will be useful for you., Correct me if anything wrong


Thanks
Shashank
CSE,BIT Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ problem- TRICOUNT

2011-06-04 Thread Anirudh S
I am still working on arriving at a recursive solution but these links might
help.

http://mathworld.wolfram.com/TriangleTiling.html
http://oeis.org/A002717


On Mon, Mar 21, 2011 at 5:50 PM, cegprakash  wrote:

> hello... someone plz tell me how to arrive @ that formula..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Google Question

2011-06-04 Thread bittu
well i can speak much on these question.as these algorithms are part
of web crawler ..but do u mean we have to detect the duplicate files,
by file having same size are duplicates..??

also same question raised by me few days back "Detecting Duplicate
Documents" but no one seems to interested u can  search previous
threads..

Thanks
Shashank

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Google Question

2011-06-04 Thread bittu
@Nate...Both TinyUrl & Bit.ly Fails in case of our web address is less
then length of their(tinyurl/bit.ly) names..
example if u will try http://www.a.com/a (num of chars 18)  in
tinyurl.com it will convert http://tinyurl.com/cl3nc4 which 25 chars
long & surly greater then original url length so these service are not
good for small length of urls..its my observation so their purpose to
make large url into tiny they are surely either using hash function of
base 36(26chars=10 digits) or base 62 chars (26+26+10) in case of case
sensitive as "A is differ from a" or they are using random number
generation by converting between 0 to 10. if we need all possible &
shortest url possible then we can count ascii chars of base 256 or
unicode characters.

as we know each url is unique in world of internet. every long URL is
associated with a unique key, which is the part after http://top-level
domain name/mypage.html , for example http://tinyurl.com/m3q2xt has a
key of m3q2xt.  so basically we have to generate the unique key as
shown in example from string after top level domain so hash function
obvious choice as urls are unique key will be unique for example
www.google.com/abc  & www.google.com/bac will generate different key
thus unique

any other approach

Thanks
Shashank


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] box packing

2011-06-04 Thread Vipul Kumar
For rotation case, take all the orientation of a box in account and
now apply the same algo

On Sat, Jun 4, 2011 at 3:13 PM, Piyush Sinha  wrote:
> For the rotation case, sort on the basis of volume...
>
> On 6/4/11, NIKHIL  wrote:
>> given the boxes with dimentions in form (L,B,H)
>> find the sequence in which the boxes can be stored inside the other.
>>
>> for eg.
>>
>> a=4,4,5
>> b=3,4,3
>> c=3,4,6
>> d=2,3,2
>>
>> a(b(d))
>> without rotation :
>> is this correct logic
>>
>> sort on the basis of length and breadth and height
>> then find lis on the basis of height starting from the bottom most box
>> in the sorted sequence
>>
>> what for rotation case
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to 
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Read a data from given particular memory location in C++

2011-06-04 Thread Navneet Gupta
Can't think of any trivial/straight forward way of doing that other
than dereferencing pointer.

On Sat, Jun 4, 2011 at 3:34 PM, D.N.Vishwakarma@IITR  wrote:
> I'm saying that int *x=new int(3); is a statement .
> I want to find value at location allocated by new which is 3 in this case by
> indirect way ... without use of (void*)x.
>
> On Sat, Jun 4, 2011 at 3:23 PM, Navneet  wrote:
>>
>> Sorry but the context is not very clear. What exactly are you trying
>> to do?
>> Looks like you want to allocate space for an integer value and assign
>> the value p to it.
>> So, you need to refer it with some pointer (in this case x).
>>
>>
>> On Jun 4, 2:24 pm, "D.N.Vishwakarma@IITR "  wrote:
>> > say memory location is 0x33f070  of int *x=new int(p);
>> >  p is some value at that location. we have to find p  at that location
>> > using
>> > some indirect way...
>> > without using cout<<(void*x); Is there any other way to find p?
>> >
>> > --
>> > **With Regards
>> > Deoki Nandan Vishwakarma
>> > IITR MCA
>> > Mathematics Department*
>> > *
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> With Regards
> Deoki Nandan Vishwakarma
> IITR MCA
> Mathematics Department
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
--Navneet

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Read a data from given particular memory location in C++

2011-06-04 Thread D.N.Vishwakarma@IITR
I'm saying that int *x=new int(3); is a statement .
I want to find value at location allocated by new which is 3 in this case by
indirect way ... without use of (void*)x.

On Sat, Jun 4, 2011 at 3:23 PM, Navneet  wrote:

> Sorry but the context is not very clear. What exactly are you trying
> to do?
> Looks like you want to allocate space for an integer value and assign
> the value p to it.
> So, you need to refer it with some pointer (in this case x).
>
>
> On Jun 4, 2:24 pm, "D.N.Vishwakarma@IITR "  wrote:
> > say memory location is 0x33f070  of int *x=new int(p);
> >  p is some value at that location. we have to find p  at that location
> using
> > some indirect way...
> > without using cout<<(void*x); Is there any other way to find p?
> >
> > --
> > **With Regards
> > Deoki Nandan Vishwakarma
> > IITR MCA
> > Mathematics Department*
> > *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
**With Regards
Deoki Nandan Vishwakarma
IITR MCA
Mathematics Department*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Read a data from given particular memory location in C++

2011-06-04 Thread Navneet
Sorry but the context is not very clear. What exactly are you trying
to do?
Looks like you want to allocate space for an integer value and assign
the value p to it.
So, you need to refer it with some pointer (in this case x).


On Jun 4, 2:24 pm, "D.N.Vishwakarma@IITR "  wrote:
> say memory location is 0x33f070  of int *x=new int(p);
>  p is some value at that location. we have to find p  at that location using
> some indirect way...
> without using cout<<(void*x); Is there any other way to find p?
>
> --
> **With Regards
> Deoki Nandan Vishwakarma
> IITR MCA
> Mathematics Department*
> *

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] box packing

2011-06-04 Thread Piyush Sinha
For the rotation case, sort on the basis of volume...

On 6/4/11, NIKHIL  wrote:
> given the boxes with dimentions in form (L,B,H)
> find the sequence in which the boxes can be stored inside the other.
>
> for eg.
>
> a=4,4,5
> b=3,4,3
> c=3,4,6
> d=2,3,2
>
> a(b(d))
> without rotation :
> is this correct logic
>
> sort on the basis of length and breadth and height
> then find lis on the basis of height starting from the bottom most box
> in the sorted sequence
>
> what for rotation case
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Read a data from given particular memory location in C++

2011-06-04 Thread D.N.Vishwakarma@IITR
say memory location is 0x33f070  of int *x=new int(p);
 p is some value at that location. we have to find p  at that location using
some indirect way...
without using cout<<(void*x); Is there any other way to find p?

-- 
**With Regards
Deoki Nandan Vishwakarma
IITR MCA
Mathematics Department*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Array Merge Problem

2011-06-04 Thread ross
Hi Rohit & all,
Sorry that there was a small typo in the 'n' 'm' texts.
The example given by me is anyway the correct one.
Sravan Reddy's solution worked fine.

On Jun 4, 10:08 am, rohit  wrote:
> i think solution would be like this
>
> eg:
> A : 1 2 3 B: 0 1.5 4 5 9
> Output:
> A can contain any combination of nos 0,1,1.5
> and B should contain 2 3 4 5 9 (in any order.)
>
> this example is given by ROSS itself.
>
> so sravanreddy solution is right , correct me if i'm wrong.
>
> On Jun 3, 8:07 pm, bittu  wrote:
>
>
>
>
>
>
>
> > @sravanreddy...logical bugs  if A is size of n & B is size m from your
> > example  assuming n > only capacity of n elements & didn't allocate memory so these elements
> > initialized by INT_MIN for m-n nodes so thatarrayA can hold m
> > smallest elements then what r u swapping u dude..isn't garbage
> > value ?? you will get at 1st step only just run it ?? in you algo
> > A_End=m-1(which 4th position inArraythat DNE)..?? & also you have to
> > free memory for  m-n  inarrayB as it contains n largest elements .
>
> > take
> > A= 1,2,3 n=3
> > B= 0,1,4,5,9 m=5
>
> > after allocating memory toArrayA  for  m-n elements A will looks
> > likes 1 2 3 INT_Max INT_Max
> > now what you wants A should contains m smallest elements & B have n
> > largest elements
> > so O/P should be  A=1,2,3,1,0 & B=INT_Max,INT_Max,4,5,9 now free
> > memory used by 1st elements inarrayB so that A will represent M
> > smallest elements & B will have n Largest elements
>
> > so that above will work.
>
> > Hope I am Correct let me know if any issue with explanation
>
> > Thanks
> > Shashank>>"The Best Way To Escape From Theproblemis To Solve It"
> > CSE,BIT Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c output

2011-06-04 Thread Dv!! ITs nt me now!!
 statement  starts executing from the right side!!! 1st it reads it
from left !! while reading b increment two times and new value of b is
thn 5 nw it gets executed!!!
am i right??

On 6/4/11, hary rathor  wrote:
> in 1st pass
>
> both ++b
> ++b= 4 then ++b= 5;
>
> at second pass a= 5*5; because ++b is 5
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Dhruva Verma
BTech(IT)-2nd year
IIIT-Allahabad

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Brain Teaser Digest Of The Week 30thMay - 03rd july

2011-06-04 Thread Lavesh Rawat
 *Hi*
*
*
*Puzzle Digest Of The Week 30May - 03July*
*
*
*
http://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.html?lavesh=lavesh
*
*
*
*http://dailybrainteaser.blogspot.com/2011/06/assemble-riddle-2-april.html?*
*lavesh=lavesh*
*
*
*http://dailybrainteaser.blogspot.com/2011/06/trap-door-puzzle-1-april.html?
**lavesh=lavesh*
*
*
*http://dailybrainteaser.blogspot.com/2011/05/trolls-riddle-31-may.html?**
lavesh=lavesh*
*
*
*
http://dailybrainteaser.blogspot.com/2011/05/aeroplane-hijack-puzzle-30-may.html
?**lavesh=lavesh*
*
*
*Please subscribe and follow this blog to show your liking to the blog.*
*
*
*
*
*You Can Also follow us on Facebook by liking this page*
*http://www.facebook.com/pages/Brain-Teasers/215057538517190*

-- 

"Never explain yourself. Your friends don’t need it and
your enemies won’t believe it" .

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.