[algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rajesh Kumar
class StringTimes
{
public static void main(String args[])
{
String str=Hi;
long i=2;
String get;
get=stringTimes(str,i);
System.out.println(get);
}
public static String stringTimes(String str,long x)
{
  int i;
 String set=str;
 for(i=0;in-1;i++)
 {
 set+=str;
 }
 return set;
}
}

OUTPUT should be like:HiHi

but it gives error plz someone help me
-- 
Regards
Rajesh Kumar

-- 
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] Fwd: why we can not swap values using macro?

2011-10-09 Thread Rajesh Kumar
-- Forwarded message --
From: Rajesh Kumar testalgori...@gmail.com
Date: Sun, Oct 9, 2011 at 2:58 PM
Subject: why we can not swap values using macro?
To: algogeeks@googlegroups.com


why this code doesn't swap values of x and y?

#includestdio.h
#define swap(a,b,c) c t;t=a,a=b,b=t;
main()
{
float x=10,y=20;
float *p,*q;
p=x,q=y;
swap(p,q,float *);
printf(%d %d\n,x,y);
}


-- 
Regards
Rajesh Kumar





-- 
Regards
Rajesh Kumar

-- 
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] error in c++ program

2011-09-22 Thread Rajesh Kumar
how we can remove error ?
#includeiostream
using namespace std;
class time
{
int m;
int h;
public:
void set(int,int);
void sum(time,time,time);
void display();
};
void time::set(int x,int y)
{
m=x;
h=y;
}
void time::sum(time t1,time t2,time t3)
{
m=t1.m+t2.m+t3.m;
h=t1.h+t2.h+t3.h;
}
void time::display(void)
{
coutminute==mendl;
couthours==hendl;
}
int main()
{
time a,b,c,d;
a.set(1,2);
b.set(2,4);
c.set(4,8);
d.sum(a,b,c);
//display
a.display();
b.display();
c.display();
d.display();
}

Regards
Rajesh Kumar

-- 
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: error in c++ program

2011-09-22 Thread Rajesh Kumar
not working by changes provide by you

On Thu, Sep 22, 2011 at 9:42 PM, payal gupta gpt.pa...@gmail.com wrote:

 #includeiostream.h

 class time
 {
 int m;
 int h;
 public:
 void set(int,int);
 void sum(time,time,time);
 void display();
 };
 void time::set(int x,int y)
 {
 m=x;
 h=y;
 }
 void time::sum(time t1,time t2,time t3)
 {
 m=t1.m+t2.m+t3.m;
 h=t1.h+t2.h+t3.h;
 }
 void time::display(void)
 {
 coutminute==mendl;
 couthours==hendl;
 }
 int main()
 {
 time a,b,c,d;
 a.set(1,2);
 b.set(2,4);
 c.set(4,8);
 d.sum(a,b,c);
 //display
 a.display();
 b.display();
 c.display();
 d.display();
 return 0;
 }



 dis does works...chk it  out!!!

 Regards,
 PAYAL GUPTA,
 CSE-3rd yr,
 NIT_B

 On Thu, Sep 22, 2011 at 9:28 PM, Don dondod...@gmail.com wrote:

 Give us some help. What is the error? Syntax error? Logic error?
 Runtime error?

 On Sep 22, 10:47 am, Rajesh Kumar testalgori...@gmail.com wrote:
  how we can remove error ?
  #includeiostream
  using namespace std;
  class time
  {
  int m;
  int h;
  public:
  void set(int,int);
  void sum(time,time,time);
  void display();};
 
  void time::set(int x,int y)
  {
  m=x;
  h=y;}
 
  void time::sum(time t1,time t2,time t3)
  {
  m=t1.m+t2.m+t3.m;
  h=t1.h+t2.h+t3.h;}
 
  void time::display(void)
  {
  coutminute==mendl;
  couthours==hendl;}
 
  int main()
  {
  time a,b,c,d;
  a.set(1,2);
  b.set(2,4);
  c.set(4,8);
  d.sum(a,b,c);
  //display
  a.display();
  b.display();
  c.display();
  d.display();
 
  }
 
  Regards
  Rajesh Kumar

 --
 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
Rajesh Kumar

-- 
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: error in c++ program

2011-09-22 Thread Rajesh Kumar
thanx Rahul

On Thu, Sep 22, 2011 at 11:54 PM, abhinav gupta abhinav@gmail.comwrote:

 @rahul
 +1


 On Thu, Sep 22, 2011 at 11:20 PM, rahul vatsa vatsa.ra...@gmail.comwrote:

 time is a keyword in c/cpp, change time to any other string in ur code nd
 it will work.



 On Thu, Sep 22, 2011 at 12:27 PM, Rajesh Kumar 
 testalgori...@gmail.comwrote:

 not working by changes provide by you


 On Thu, Sep 22, 2011 at 9:42 PM, payal gupta gpt.pa...@gmail.comwrote:

 #includeiostream.h

 class time
 {
 int m;
 int h;
 public:
 void set(int,int);
 void sum(time,time,time);
 void display();
 };
 void time::set(int x,int y)
 {
 m=x;
 h=y;
 }
 void time::sum(time t1,time t2,time t3)
 {
 m=t1.m+t2.m+t3.m;
 h=t1.h+t2.h+t3.h;
 }
 void time::display(void)
 {
 coutminute==mendl;
 couthours==hendl;
 }
 int main()
 {
 time a,b,c,d;
 a.set(1,2);
 b.set(2,4);
 c.set(4,8);
 d.sum(a,b,c);
 //display
 a.display();
 b.display();
 c.display();
 d.display();
 return 0;
 }



 dis does works...chk it  out!!!

 Regards,
 PAYAL GUPTA,
 CSE-3rd yr,
 NIT_B

 On Thu, Sep 22, 2011 at 9:28 PM, Don dondod...@gmail.com wrote:

 Give us some help. What is the error? Syntax error? Logic error?
 Runtime error?

 On Sep 22, 10:47 am, Rajesh Kumar testalgori...@gmail.com wrote:
  how we can remove error ?
  #includeiostream
  using namespace std;
  class time
  {
  int m;
  int h;
  public:
  void set(int,int);
  void sum(time,time,time);
  void display();};
 
  void time::set(int x,int y)
  {
  m=x;
  h=y;}
 
  void time::sum(time t1,time t2,time t3)
  {
  m=t1.m+t2.m+t3.m;
  h=t1.h+t2.h+t3.h;}
 
  void time::display(void)
  {
  coutminute==mendl;
  couthours==hendl;}
 
  int main()
  {
  time a,b,c,d;
  a.set(1,2);
  b.set(2,4);
  c.set(4,8);
  d.sum(a,b,c);
  //display
  a.display();
  b.display();
  c.display();
  d.display();
 
  }
 
  Regards
  Rajesh Kumar

 --
 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
 Rajesh Kumar


  --
 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.




-- 
Regards
Rajesh Kumar

-- 
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] what is meaning of STAT field in ps command

2011-09-08 Thread Rajesh Kumar
output of ps aux command looklike--
USER  PID   %CPU   %MEMVSZ  RSS   TTY  STAT  START   TIME
COMMAND
x 1433   0.0 0.123940 2548?  Sl
  05:55   0:00/usr/bin/gnome-
y 1512   0.0 0.294388 4772?
 Ssl05:55   0:00/usr/bin/pulsea

what is meaning of Sl and Ssl in the STAT field?
-- 
Regards
Rajesh Kumar

-- 
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] problem regarding output??

2011-08-09 Thread Rajesh Kumar
why j and k  point different location?

#includestdio.h
main()
{
int a=10,*j;
void *k;
j=k=a;
k=(int *)k;
k++;
j++;
printf(%u %u\n,j,k);
}


-- 
Regards
Rajesh Kumar

-- 
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] problem regarding output??

2011-08-09 Thread Rajesh Kumar
thanx Ankit

On Tue, Aug 9, 2011 at 5:27 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 its because void pointer is incremented by 1, when we do k++
 whereas integer pointer is incremented by 4, when we do j++

 --
 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
Rajesh Kumar

-- 
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] how to reverse a string in place??plz post code also

2011-08-07 Thread Rajesh Kumar
-- 
Regards
Rajesh Kumar

-- 
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] how to reverse a string in place??plz post code also

2011-08-07 Thread Rajesh Kumar
plz post code in c language also.

On Sun, Aug 7, 2011 at 8:26 PM, Kunal Yadav kunalyada...@gmail.com wrote:

 #includestdio.h
 #includeiostream
 #includestring.h
 #includestdlib.h
 using namespace std;
 int main()
 {
char s[1000];
cins;
int start=0;
int end=strlen(s);
coutendendl;
int end1=end;
while(start=end)
 {
 char e;  //swap
 e=s[start];
 s[start]=s[end];
 s[end]=e;
start++;
end--;
}
for(int i=0;i=end1;i++)
couts[i];
return 0;

 }


 On Sun, Aug 7, 2011 at 8:24 PM, Rajesh Kumar testalgori...@gmail.comwrote:



 --
 Regards
 Rajesh Kumar


  --
 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
 Kunal Yadav
 (http://algoritmus.in/)

  --
 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
Rajesh Kumar

-- 
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] How remove error?

2011-08-06 Thread Rajesh Kumar
How remoe error of this code?

#includestdio.h
main()
{
int i=10,j=15;
if(i%2=i%3)
printf(\ncharacter);
}

-- 
Regards
Rajesh Kumar

-- 
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] How remove error?

2011-08-06 Thread Rajesh Kumar
sorry actually their code is this.
how to remove error in this code?

#includestdio.h
main()
{
int i=10,j=15;
if(i%2=j%3)
printf(\ncharacter);
}

On Sat, Aug 6, 2011 at 3:37 PM, prasad jondhale
jondhale.pra...@gmail.comwrote:

 you shud use address on left hand side of assignment operator
 so above pgm will give error:lvalue required

 On 8/6/11, siddharam suresh siddharam@gmail.com wrote:
  is this *i%2=i%3 *valid statement?
  Thank you,
  Siddharam
 
 
  On Sat, Aug 6, 2011 at 3:23 PM, Rajesh Kumar testalgori...@gmail.com
 wrote:
 
  How remoe error of this code?
 
  #includestdio.h
  main()
  {
  int i=10,j=15;
  if(i%2=i%3)
  printf(\ncharacter);
  }
 
  --
  Regards
  Rajesh Kumar
 
 
   --
  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
 Prasad Y.Jondhale
 M.Tech(software engg.),
 Delhi College Of Engineering,
 Main Bawana road,Delhi-110042
 Ph-09540208001

 --
 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
Rajesh Kumar

-- 
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] Error in code?plz help...

2011-08-06 Thread Rajesh Kumar
How to remove error in this code?

#includestdio.h
main()
{
int i=10,j=15;
if(i%2=j%3)
printf(\ncharacter);
}

-- 
Regards
Rajesh Kumar

-- 
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] order of evalution of variable problem

2011-08-06 Thread Rajesh Kumar
how the evalution done on such type problem?

#includestdio.h
main()
{
int i=-3,j=2,k=0,m;
m=++i  ++j || k++;
printf(%d %d %d %d\n,i,j,k,m);
}

-- 
Regards
Rajesh Kumar

-- 
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] output???

2011-08-05 Thread Rajesh Kumar
program output comes - hi
why??

#includestdio.h
main()
{
float a=0.7;
if(.7 a)
printf(hi\n);
else
printf(hello\n);
}

-- 
Regards
Rajesh Kumar

-- 
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] output???

2011-08-05 Thread Rajesh Kumar
Thanks to all

On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan sukrandha...@gmail.comwrote:

 coz by default all real values are converted to double and it is larger
 than float.ie real nos are not stored accurately inside computer memory.so
 since double occupies more memory it prints hi


 On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal 
 kamakshi...@gmail.comwrote:

 the reason is dat 0.7 is treated as double..therefore double(0.7)
 float(0.7)

 On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan kartik.sac...@gmail.comwrote:

 the output will be hi

 even if u have putted equal to sign there this is becoz 0.7 do not
 exactly stored like 0.7 in a but some thing lesser as describe in ASCII
 format
 that's why it is awlays lesser than 0.7

  --
 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,
 Kamakshi
 kamakshi...@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
Rajesh Kumar

-- 
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] data type size problem

2011-08-03 Thread Rajesh Kumar
why output of this code  goes to infinite.

#includestdio.h
main()
{
unsigned int i=4294967295;//size of unsigned int is 4 byte
while(i++!=0)
printf(%d,++i);
printf(\n);
}



Regards
Rajesh Kumar

-- 
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: data type size problem

2011-08-03 Thread Rajesh Kumar
how i gets value 1 3 5 7..even it is initialized by 4294967295.

On Wed, Aug 3, 2011 at 6:36 PM, ManishMCS manishdaw...@gmail.com wrote:

 It is going to infinite because 4294967295 is not equal to 0, so you
 enters the loop. And in loop, you again increments the value.. So, it
 print values lyk 1 3.. 4294967295 and again 1.. So, basically it
 prints all odd values...

 --
 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
Rajesh Kumar

-- 
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: data type size problem

2011-08-03 Thread Rajesh Kumar
plz explain what is roll over of value?

On Wed, Aug 3, 2011 at 7:11 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote:


 roll over of valuei has an upper limit
 On Wed, Aug 3, 2011 at 3:39 PM, Rajesh Kumar testalgori...@gmail.comwrote:

 how i gets value 1 3 5 7..even it is initialized by 4294967295.


 On Wed, Aug 3, 2011 at 6:36 PM, ManishMCS manishdaw...@gmail.com wrote:

 It is going to infinite because 4294967295 is not equal to 0, so you
 enters the loop. And in loop, you again increments the value.. So, it
 print values lyk 1 3.. 4294967295 and again 1.. So, basically it
 prints all odd values...

 --
 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
 Rajesh Kumar


 --
 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
Rajesh Kumar

-- 
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] compilation error

2011-08-02 Thread Rajesh Kumar
Why this program  is showing compilation error?

#includestdio.h
main()
{
float a=3.14;
a=a%3;
double d=6.28;
d=d%4;
}
-- 
Regards
Rajesh Kumar

-- 
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] compilation error

2011-08-02 Thread Rajesh Kumar
thanx to all for giving me preety advice

On Tue, Aug 2, 2011 at 6:02 PM, sachin sharma sachin.bles...@gmail.comwrote:

 /* fmod example */#include stdio.h#include math.h
 int main (){
   printf (fmod of 5.3 / 2 is %lf\n, fmod (5.3,2) );
   printf (fmod of 18.5 / 4.2 is %lf\n, fmod (18.5,4.2) );
   return 0;}



 Best Wishes
 Sachin Sharma

  --
 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
Rajesh Kumar

-- 
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] doubly linked list program error

2011-08-01 Thread Rajesh Kumar
programs gives segmentation fault when we creat linked list
plz help me

#includestdio.h
#includemalloc.h
#includestdlib.h
struct node
{
struct node *prev;
int info;
struct node *next;
}*start;

main()
{
int choice,n,m,po,i;
start=NULL;
while(1)
{
printf(1.Create List\n);
printf(2.Add at begining\n);
printf(3.Add after\n);
printf(4.Delete\n);
printf(5.Display\n);
printf(6.Count\n);
printf(7.Reverse\n);
printf(8.exit\n);
printf(Enter your choice : );
scanf(%d,choice);
switch(choice)
{
 case 1:
printf(How many nodes you want : );
scanf(%d,n);
for(i=0;in;i++)
{
printf(Enter the element : );
scanf(%d,m);
create_list(m);
}
break;
 case 2:
printf(Enter the element : );
scanf(%d,m);
addatbeg(m);
break;
 case 3:
printf(Enter the element : );
scanf(%d,m);
printf(Enter the position after which this element is inserted
: );
scanf(%d,po);
addafter(m,po);
break;
 case 4:
printf(Enter the element for deletion : );
scanf(%d,m);
del(m);
break;
 case 5:
display();
break;
 case 6:
count();
break;
 case 7:
rev();
break;
 case 8:
exit(1);
 default:
printf(Wrong choice\n);
}/*End of switch*/
   }/*End of while*/
}/*End of main()*/

create_list(int num)
{
struct node *q,*tmp;
tmp= malloc(sizeof(struct node));
tmp-info=num;
tmp-next=NULL;
if(start==NULL)
{
tmp-prev=NULL;
start-prev=tmp;
start=tmp;
}
else
{
q=start;
while(q-next!=NULL)
q=q-next;
q-next=tmp;
tmp-prev=q;
}
}/*End of create_list()*/

addatbeg(int num)
{
struct node *tmp;
tmp=malloc(sizeof(struct node));
tmp-prev=NULL;
tmp-info=num;
tmp-next=start;
start-prev=tmp;
start=tmp;
}/*End of addatbeg()*/

addafter(int num,int c)
{
struct node *tmp,*q;
int i;
q=start;
for(i=0;ic-1;i++)
{
q=q-next;
if(q==NULL)
{
printf(There are less than %d elements\n,c);
return;
}
}
tmp=malloc(sizeof(struct node));
tmp-info=num;
q-next-prev=tmp;
tmp-next=q-next;
tmp-prev=q;
q-next=tmp;
}/*End of addafter() */

del(int num)
{
struct node *tmp,*q;
tmp=malloc(sizeof(struct node));
if(start-info==num)
{
tmp=start;
start=start-next;  /*first element deleted*/
start-prev = NULL;
free(tmp);
return;
}
q=start;
while(q-next-next!=NULL)
{
if(q-next-info==num) /*Element deleted in between*/
{
tmp=q-next;
q-next=tmp-next;
tmp-next-prev=q;
free(tmp);
return;
}
q=q-next;
}
if(q-next-info==num)/*last element deleted*/
{   tmp=q-next;
free(tmp);
q-next=NULL;
return;
}
printf(Element %d not found\n,num);
}/*End of del()*/

display()
{
struct node *q;
if(start==NULL)
{
printf(List is empty\n);
return;
}
q=start;
printf(List is :\n);
while(q!=NULL)
{
printf(%d , q-info);
q=q-next;
}
printf(\n);
}/*End of display() */

count()
{   struct node *q=start;
int cnt=0;
while(q!=NULL)
{
q=q-next;
cnt++;
}
printf(Number of elements are %d\n,cnt);
}/*End of count()*/

rev()
{
struct node *p1,*p2;
p1=start;
p2=p1-next;
p1-next=NULL;
p1-prev=p2;
while(p2!=NULL)
{
p2-prev=p2-next;
p2-next=p1;
p1=p2;
p2=p2-prev; /*next of p2 changed to prev */
}
start=p1;
}/*End of rev()*/


-- 
Regards
Rajesh Kumar

-- 
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: doubly linked list program error

2011-08-01 Thread Rajesh Kumar
Thanx a lot 

On Mon, Aug 1, 2011 at 6:32 PM, Amethy hobby news...@gmail.com wrote:

 if(start==NULL)
{
tmp-prev=NULL;
// run  here , the start==null, so the start-prev is error
start-prev=tmp;//here

start=tmp;
 }

 On 8月1日, 下午8时41分, Rajesh Kumar testalgori...@gmail.com wrote:
  programs gives segmentation fault when we creat linked list
  plz help me
 
  #includestdio.h
  #includemalloc.h
  #includestdlib.h
  struct node
  {
  struct node *prev;
  int info;
  struct node *next;
 
  }*start;
 
  main()
  {
  int choice,n,m,po,i;
  start=NULL;
  while(1)
  {
  printf(1.Create List\n);
  printf(2.Add at begining\n);
  printf(3.Add after\n);
  printf(4.Delete\n);
  printf(5.Display\n);
  printf(6.Count\n);
  printf(7.Reverse\n);
  printf(8.exit\n);
  printf(Enter your choice : );
  scanf(%d,choice);
  switch(choice)
  {
   case 1:
  printf(How many nodes you want : );
  scanf(%d,n);
  for(i=0;in;i++)
  {
  printf(Enter the element : );
  scanf(%d,m);
  create_list(m);
  }
  break;
   case 2:
  printf(Enter the element : );
  scanf(%d,m);
  addatbeg(m);
  break;
   case 3:
  printf(Enter the element : );
  scanf(%d,m);
  printf(Enter the position after which this element is
 inserted
  : );
  scanf(%d,po);
  addafter(m,po);
  break;
   case 4:
  printf(Enter the element for deletion : );
  scanf(%d,m);
  del(m);
  break;
   case 5:
  display();
  break;
   case 6:
  count();
  break;
   case 7:
  rev();
  break;
   case 8:
  exit(1);
   default:
  printf(Wrong choice\n);
  }/*End of switch*/
 }/*End of while*/
 
  }/*End of main()*/
 
  create_list(int num)
  {
  struct node *q,*tmp;
  tmp= malloc(sizeof(struct node));
  tmp-info=num;
  tmp-next=NULL;
  if(start==NULL)
  {
  tmp-prev=NULL;
  start-prev=tmp;
  start=tmp;
  }
  else
  {
  q=start;
  while(q-next!=NULL)
  q=q-next;
  q-next=tmp;
  tmp-prev=q;
  }
 
  }/*End of create_list()*/
 
  addatbeg(int num)
  {
  struct node *tmp;
  tmp=malloc(sizeof(struct node));
  tmp-prev=NULL;
  tmp-info=num;
  tmp-next=start;
  start-prev=tmp;
  start=tmp;
 
  }/*End of addatbeg()*/
 
  addafter(int num,int c)
  {
  struct node *tmp,*q;
  int i;
  q=start;
  for(i=0;ic-1;i++)
  {
  q=q-next;
  if(q==NULL)
  {
  printf(There are less than %d elements\n,c);
  return;
  }
  }
  tmp=malloc(sizeof(struct node));
  tmp-info=num;
  q-next-prev=tmp;
  tmp-next=q-next;
  tmp-prev=q;
  q-next=tmp;
 
  }/*End of addafter() */
 
  del(int num)
  {
  struct node *tmp,*q;
  tmp=malloc(sizeof(struct node));
  if(start-info==num)
  {
  tmp=start;
  start=start-next;  /*first element deleted*/
  start-prev = NULL;
  free(tmp);
  return;
  }
  q=start;
  while(q-next-next!=NULL)
  {
  if(q-next-info==num) /*Element deleted in between*/
  {
  tmp=q-next;
  q-next=tmp-next;
  tmp-next-prev=q;
  free(tmp);
  return;
  }
  q=q-next;
  }
  if(q-next-info==num)/*last element deleted*/
  {   tmp=q-next;
  free(tmp);
  q-next=NULL;
  return;
  }
  printf(Element %d not found\n,num);
 
  }/*End of del()*/
 
  display()
  {
  struct node *q;
  if(start==NULL)
  {
  printf(List is empty\n);
  return;
  }
  q=start;
  printf(List is :\n);
  while(q!=NULL)
  {
  printf(%d , q-info);
  q=q-next;
  }
  printf(\n);
 
  }/*End of display() */
 
  count()
  {   struct node *q=start;
  int cnt=0;
  while(q!=NULL)
  {
  q=q-next;
  cnt++;
  }
  printf(Number of elements are %d\n,cnt);
 
  }/*End of count()*/
 
  rev()
  {
  struct node *p1,*p2;
  p1=start;
  p2=p1-next;
  p1-next=NULL;
  p1-prev=p2;
  while(p2!=NULL)
  {
  p2-prev=p2-next;
  p2-next=p1;
  p1=p2;
  p2=p2-prev; /*next of p2 changed to prev */
  }
  start=p1;
 
  }/*End of rev()*/
 
  --
  Regards
  Rajesh Kumar

 --
 You received this message because you are subscribed to the Google Groups

[algogeeks] problem of structur

2011-07-31 Thread Rajesh Kumar
What is Error in This program??plzrply
#includestdio.h
f(struct epm);
struct emp
{
char name[20];
int age;
};
main()
{
struct emp e={qwe,12};
f(e);
}
f(struct emp ee)
{
printf(%s ...%d\n,ee.name,ee.age);
}


-- 
Rajesh Kumar

-- 
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] Rajesh Kumar wants to chat

2011-07-31 Thread Rajesh Kumar
---

Rajesh Kumar wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-35ff6532a6-5d4b375227-bNzxUmbwNA85_wpli7pdkf9R_4k
You'll need to click this link to be able to chat with Rajesh Kumar.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with Rajesh Kumar, visit:
http://mail.google.com/mail/a-35ff6532a6-5d4b375227-bNzxUmbwNA85_wpli7pdkf9R_4k

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into conversations
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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] Complexity of Algorithms

2010-05-07 Thread rajesh kumar
check  the design and analysis of algorithm by thomas cormen

On Mon, May 3, 2010 at 11:45 PM, scanfile rahul08k...@gmail.com wrote:

 Pls can anyone help me out that how to calculate the complexity of any
 Algorithm?

 --
 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.comalgogeeks%2bunsubscr...@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 algoge...@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.