[algogeeks] Openings in Mentor Graphics,Noida Location

2015-11-16 Thread Ashish kumar Jain
Anybody interested to join Mentor Graphics Noida having 1-10 years of
experience in C/C++/DS/Algo can forward his/her resume to me.

Please understand that the opening needs to be closed urgently.So,Hurry up.

Note: Please ignore if inappropriate for this forum.


-- 
Regards,
Ashish

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2012-06-07 Thread ashish kumar
please send me the download link @hi.ashish...@gmail.com.
..Thanks

On Thu, Jun 7, 2012 at 3:28 PM, sengar.mahi sengar.m...@gmail.com wrote:

 http://users.ece.utexas.edu/~adnan/afi-samples.pdf

 is dis wat u al r lukin 4??


 On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma abhi120...@gmail.comwrote:

 yes,it is helpful,but read it only if u have fully understood
 Introduction to algorithms or if u have strong foundation of
 algorithms/data structures


 On Thu, Jun 7, 2012 at 12:37 PM, BUBUN SHEKHAR dce.stu...@gmail.comwrote:

 Guys is this book useful for cracking interviews??

 On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote:

 If any one have algorithms for interviews by adnan aziz ebook... Please
 mail ...
 Thanks

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




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

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




-- 
Ashish Kumar
Bharat Electronics Ltd
Ghaziabad
+91 8527110885

-- 
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] very urgent .. help

2011-09-04 Thread ashish kumar
there are 3 sections verbal,problemsolving and quant .. questions are
tough..

On Sun, Sep 4, 2011 at 2:06 PM, mani walia manis...@gmail.com wrote:

 ph elitmus test??


 what is that??

 and how to prepare for that??


 can anyone provide me with good sources for preparation??  please

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




-- 
Ashish kumar
ECE final yr
MNNIT 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] apti! solve this!

2011-08-17 Thread Ashish kumar Jain
sqrt(146)

On Wed, Aug 17, 2011 at 7:43 PM, priya ramesh 
love.for.programm...@gmail.com wrote:

  A moves 3 kms east from his starting point . He then travels 5 kms north.
 From that point he moves 8 kms to the east.How far is A from his starting
 point?

 --
 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,
Ashish

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

2011-08-17 Thread Ashish kumar Jain
If it is assumed to be of uniform density,then 3 kg should be the weight.For
any non-uniformity,please mention the mass distribution function to be
considered.

On Tue, Aug 16, 2011 at 5:14 PM, Carl Barton odysseus.ulys...@gmail.comwrote:

 Depends which quarter you're measuring. Bricks aren't a uniform cuboid so
 wont be 1kg per quarter


 On 16 August 2011 12:16, sukran dhawan sukrandha...@gmail.com wrote:


 which college are u from?
 -- Forwarded message --
 From: ravinder s ravinderr...@gmail.com
 Date: Tue, Aug 16, 2011 at 4:15 PM
 Subject: [algogeeks]
 To: algogeeks@googlegroups.com


 a brick is 4kg.If you make the brick 1/4 then how much will be its
 weight.?

 --
 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,
Ashish

-- 
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] pointer size

2011-08-04 Thread Ashish kumar Jain
Just check if you have installed DEV Cpp win32 installation or not.That will
confirm the usage and observation.As per the Dev cpp page it is available in
32 bit exe only.

On Thu, Aug 4, 2011 at 7:21 PM, Dipankar Patro dip10c...@gmail.com wrote:

 Also, you must remember that 64 OS can never run 32 bit Processors, since
 it will require a 64 bit CPU to produce a 64bit address format


 On 4 August 2011 19:19, Dipankar Patro dip10c...@gmail.com wrote:

 Yeah.

 On 4 August 2011 12:14, N1teesh nitee...@gmail.com wrote:

 So if either of the OS , Compiler , Processor are 32 Bit , then the size
 is bound to be 4 bytes?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/vsUrO_BCMXAJ.

 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 --
 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,
Ashish

-- 
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: Novell - Puzzle

2011-07-31 Thread ashish kumar
233 is the right answer..

On Fri, Jul 29, 2011 at 12:27 PM, shiv narayan narayan.shiv...@gmail.comwrote:

 solutions for cow questions:
 if we consider first cow would she calf at age 2 then first new cow
 would come at age two.
 at end of 2nd year: 1st would give new cow:
 at end of 3rd year:1st cow would another new cow
 at end of 4th year :1st cow will give new cow and the cow born at end
 of 2nd year would give another cow
 at 5th year:  :now of new cows=cow born by(1st+2nd year+3rd
 year)
 -
 -
 -
 -
 if you try it this way then you would be able to understad that it
 would be a reverse fibinacci series( try to analyse by last cow
 produced by 1st cow)
 total no of cows would be:  1+1+2+3+5+8+13+21+34+55+89=(sum of first
 11 terms of fibinacci series)
 232

 correct me if i am wrong.
 On Jul 29, 11:15 am, Reynald reynaldsus...@gmail.com wrote:
  If a cow produces its first she-calf at age two years and after that
  produces another single she-calf every year, how many she-calves are
  there after 12 years? assuming none die.
 
  and a similar one, asked to another guy,
 
  Suppose a newly-born pair of rabbits, one male, one female, are put in
  a field. Rabbits are able to mate at the age of one month so that at
  the end of its second month a female can produce another pair of
  rabbits. Suppose that our rabbits never die and that the female always
  produces one new pair (one male, one female) every month from the
  second month on. How many pairs will there be in one year?

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




-- 
Ashish kumar
ECE final yr
MNNIT 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] # References !!!!

2011-07-12 Thread Ashish kumar Jain
#includeiostream

using namespace std;



int main(void)

{

 int a=10 ,b=4;

   int c=a;



   cout\n-a;

   a+=20;

   cout\n-c;

   //

   //Add your code here.





   /*/





   cout\n-c;

  c=999;

   cout\n-b;





   cin.get();

  return 0;

}





In this code , c is a reference to a.

Task : Make c to refer towards b.



P.S: You are only allowed to add your code , within the given area. No other
 thing could  be modified. You can’t allocate any extra space too.



Present O/P:

10

30

30

4



O/P after adding your code should be:

10

30

4

999

-- 
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] # References !!!!

2011-07-12 Thread Ashish kumar Jain
You think so! Time to think again. :)



#includeiostream

using namespace std;



int main(void)

{

 int a=10 ,b=4;

   int c=a;



   cout\n-a;

   a+=20;

   cout\n-c;

   //

   //Addyour code here.



   *(unsigned long*)(((unsigned long)b)-((unsigned long)a-(unsigned
long)b)) = (unsigned long)b;



   /*/





   cout\n-c;

  c=999;

   cout\n-b;





   cin.get();

  return 0;

}




On Tue, Jul 12, 2011 at 1:06 PM, Anand Saha anands...@gmail.com wrote:

 Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5

 --


 On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 Once a reference is initialized to an object, it cannot be changed to
 refer to another object.
 Ref. Bruce Eckel - ch11

 So its Not possible
 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


  --
 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,
Ashish

-- 
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] # References !!!!

2011-07-12 Thread Ashish kumar Jain
Dev C++

On Tue, Jul 12, 2011 at 5:48 PM, Anand Saha anands...@gmail.com wrote:

 Which compiler? http://www.ideone.com/7nnse

 --


 On Tue, Jul 12, 2011 at 5:42 PM, Ashish kumar Jain akjlucky4...@gmail.com
  wrote:

 You think so! Time to think again. :)



 #includeiostream

 using namespace std;



 int main(void)

 {

  int a=10 ,b=4;

int c=a;



cout\n-a;

a+=20;

cout\n-c;

//

//Addyour code here.



*(unsigned long*)(((unsigned long)b)-((unsigned long)a-(unsigned
 long)b)) = (unsigned long)b;



/*/





cout\n-c;

   c=999;

cout\n-b;





cin.get();

   return 0;

 }




 On Tue, Jul 12, 2011 at 1:06 PM, Anand Saha anands...@gmail.com wrote:

 Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5

 --


 On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal sunny816.i...@gmail.com
  wrote:

 Once a reference is initialized to an object, it cannot be changed to
 refer to another object.
 Ref. Bruce Eckel - ch11

 So its Not possible
 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


  --
 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,
 Ashish


  --
 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,
Ashish

-- 
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] # References !!!!

2011-07-12 Thread Ashish kumar Jain
This is also somewhat compiler dependant as some compilers store references
in symbol table while others do so using stack.This one runs on stack
fundamentals.This is against C++ standards but this is just a trick for this
code on big endian which stores reference on stacks.This won't work for
little endian.

On Tue, Jul 12, 2011 at 5:50 PM, Ashish kumar Jain
akjlucky4...@gmail.comwrote:

 Dev C++


 On Tue, Jul 12, 2011 at 5:48 PM, Anand Saha anands...@gmail.com wrote:

 Which compiler? http://www.ideone.com/7nnse

 --


 On Tue, Jul 12, 2011 at 5:42 PM, Ashish kumar Jain 
 akjlucky4...@gmail.com wrote:

 You think so! Time to think again. :)



 #includeiostream

 using namespace std;



 int main(void)

 {

  int a=10 ,b=4;

int c=a;



cout\n-a;

a+=20;

cout\n-c;

//

//Addyour code here.



*(unsigned long*)(((unsigned long)b)-((unsigned long)a-(
 unsigned long)b)) = (unsigned long)b;



/*/





cout\n-c;

   c=999;

cout\n-b;





cin.get();

   return 0;

 }




 On Tue, Jul 12, 2011 at 1:06 PM, Anand Saha anands...@gmail.com wrote:

 Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5

 --


 On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal 
 sunny816.i...@gmail.com wrote:

 Once a reference is initialized to an object, it cannot be changed to
 refer to another object.
 Ref. Bruce Eckel - ch11

 So its Not possible
 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


  --
 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,
 Ashish


  --
 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,
 Ashish




-- 
Regards,
Ashish

-- 
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] [brain teaser] Salman age puzzle 7 june

2011-06-07 Thread Ashish kumar Jain
84 years.

On Tue, Jun 7, 2011 at 1:47 PM, Naveen Kumar naveenkumarve...@gmail.comwrote:

 84 years


 On Tue, Jun 7, 2011 at 1:33 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *Salman age puzzle
  *
 *
 *
 **
 *salman's youth lasted one sixth of his life. He grew a beard after one
 twelfth more. After one seventh more of his life, he married. 5 years later,
 he and his wife had a son. The son lived exactly one half as long as his
 father, and salman died four years after his son.

 How many years did salman live?
 *
 *Update Your Answers at* : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/06/salman-age-puzzle-7-june.html?lavesh=lavesh

 Solution:

 Will be updated after 1 day



 --

 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.




 --
 Cheers
 Naveen 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,
Ashish

-- 
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-05 Thread Ashish kumar Jain
Also,Please note that using relational/comparison operators with floating
point numbers/real numbers is not an advisable coding practice.

On Mon, May 30, 2011 at 8:12 PM, Dave dave_and_da...@juno.com wrote:

 @vishal: Floats and doubles are stored in different formats, so
 looking at the first 8 hex digits of the two numbers isn't really
 helpful.

 The expression f  0.8 is evaluated as (double)f  0.8, so it would be
 more useful to print all 16 hex digits of (double)0.8f and 0.8. Then
 it would be easy to see that 0.08f  0.08.

 Dave

 On May 29, 11:35 pm, Vishal Thanki vishaltha...@gmail.com wrote:
  you may want to check how the floats and doubles are stored into
  memory using ieee notation.
 
  i tried to print 0.08 and 0.08f in hex format and got the following
 result.
 
  vishal@ubuntu:~/progs/c\ 10:03:56 AM $ cat fl.c
  #include stdio.h
  int main()
  {
  float f=0.08;
  if (f  0.08f)
  printf(hi\n);
  else
  printf(hello\n);
 
  printf (%x %x\n,0.08, 0.08f);
  return 0;}
 
  vishal@ubuntu:~/progs/c\ 10:04:06 AM $ gcc fl.c
  fl.c: In function ‘main’:
  fl.c:10: warning: format ‘%x’ expects type ‘unsigned int’, but
  argument 2 has type ‘double’
  fl.c:10: warning: format ‘%x’ expects type ‘unsigned int’, but
  argument 3 has type ‘double’
  vishal@ubuntu:~/progs/c\ 10:04:11 AM $ ./a.out
  hello
  47ae147b 3fb47ae1
  vishal@ubuntu:~/progs/c\ 10:04:14 AM $
 
  ps: please ignore the warning in the code.
 
  On Sun, May 29, 2011 at 10:23 PM, sravanreddy001
 
 
 
  sravanreddy...@gmail.com wrote:
   and, I read it long time back that.. the value of 0.8 alone will be
 stored
   as 0.7995 (not sure on the number of 9's but.. the last digit
 in the
   precision will be a 5)
   that could be a reason.
   may be what vishal said is correct.
 
   --
   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.




-- 
Regards,
Ashish

-- 
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] number of inversion pairs

2010-09-18 Thread ashish kumar
On Saturday, September 18, 2010, jagadish jagadish1...@gmail.com wrote:
 Hi Raj,

 I think there is an nlogn solution to this problem which can be done
 by modifying merge sort..

 the key lies in the merge routine, when the left array elements are
 greater than the right array,
 the right array elements are copied to the tmp array .. hence , this
 adds (n-i) to the inversion count.!

 the code is below--

 int mergesort(int arr[],int l,int r) {
 if(l=r) {
 mid=l+r/2;
 return mergesort(arr,l,mid)+mergesort(arr,mid+1,r)
 +merge(a,tmp,l,mid,r);
 }
 }

 int merge(int a[],int t[],int lpos,int rpos,int rend) {
 lend=rpos-1;
 while(lpos=lend  rpos=rend) {
 if(arr[lpos]=arr[rppos] arr[tmppos++]=arr[lpos++ //dont update any
 count here,, no inversions
 else {
 //we have an inversion and elements from (lend-lpos) are inverted
 inversioncount+=lend-lpos;
 arr[tmppos++]=arr[rpos++]
 }
 if(lpos==lend) { copy from rpos to rend to tmp array }
 else {copy from lpos to lend to tmp array}  //usual mergesort thingy

 RETURN inversioncount;


 }

 }


 On Sep 13, 7:40 pm, Raj N rajn...@gmail.com wrote:
 Given an array of n integers find all the inversion pairs in O(n)
 Inversion pair is one where a[i]a[j], ij

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



-- 
Ashish Kumar
Computer Science Engg.
CUSAT
+91 9995348620

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



Re: [algogeeks] number of inversion pairs

2010-09-18 Thread ashish kumar
On Saturday, September 18, 2010, jagadish jagadish1...@gmail.com wrote:
 Hi Raj,

 I think there is an nlogn solution to this problem which can be done
 by modifying merge sort..

 the key lies in the merge routine, when the left array elements are
 greater than the right array,
 the right array elements are copied to the tmp array .. hence , this
 adds (n-i) to the inversion count.!

 the code is below--

 int mergesort(int arr[],int l,int r) {
 if(l=r) {
 mid=l+r/2;
 return mergesort(arr,l,mid)+mergesort(arr,mid+1,r)
 +merge(a,tmp,l,mid,r);
 }
 }

 int merge(int a[],int t[],int lpos,int rpos,int rend) {
 lend=rpos-1;
 while(lpos=lend  rpos=rend) {
 if(arr[lpos]=arr[rppos] arr[tmppos++]=arr[lpos++ //dont update any
 count here,, no inversions
 else {
 //we have an inversion and elements from (lend-lpos) are inverted
 inversioncount+=lend-lpos;
 arr[tmppos++]=arr[rpos++]
 }
 if(lpos==lend) { copy from rpos to rend to tmp array }
 else {copy from lpos to lend to tmp array}  //usual mergesort thingy

 RETURN inversioncount;


 }

 }


 On Sep 13, 7:40 pm, Raj N rajn...@gmail.com wrote:
 Given an array of n integers find all the inversion pairs in O(n)
 Inversion pair is one where a[i]a[j], ij

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



-- 
Ashish Kumar
Computer Science Engg.
CUSAT
+91 9995348620

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



Re: [algogeeks] ALGORITHM

2010-07-29 Thread Ashish kumar Jain
Good approach Shiv.I think thats the best way to do so.The question does not
strictly say we have consecutive n-1 distinct numbers.So,its not worth
considering that particular case.

On Thu, Jul 29, 2010 at 12:08 AM, Shiv ... shivsinha2...@gmail.com wrote:

 What if the number are not consecutive?

 My approach-
 Put the numbers in a hash till a collision occurs.


 On Wed, Jul 28, 2010 at 9:21 PM, Apoorve Mohan apoorvemo...@gmail.comwrote:

 Solution :

 1. Find Xor of numbers from 1 to n-1.

 2. Find Xor of the numbers present in the array.

 3. Xor the results from step 1 and 2 you will get the repeated number.


 On Wed, Jul 28, 2010 at 8:46 PM, akshay akshayrastogi2...@gmail.comwrote:

 An array of unsorted numbers n is given with one no.repeated once ie
 n-1 distinct nos to find duplicate no. in o(n) complexity

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




 --
 regards

 Apoorve Mohan


  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards,
Ashish

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



Re: [algogeeks] Re: Road crossing algorithm

2010-07-16 Thread Ashish kumar Jain
It is indeed an elegant interview question with respect to hiring for
designing the systems.It was asked when I was interviewed for the final
rounds of on-site interview at Google.

On Thu, Jul 15, 2010 at 11:47 PM, Tech Id tech.login@gmail.com wrote:

 Hi Ashish,

 Your algo does not have a chance for jump_back.
 This may be required for certain cases, especially when multiple cars
 are running on one lane.

 My solution was for one car on one lane, hence car_times[i] gives the
 car in i-th lane will take to hit the path frog is trying to cross.
 It should not be too difficult to put multiple cars on single lane in
 my algo.

 Actually, from a game perspective, the problem can have many parts
 like:
 speed of cars vary,
 frog can move sideways too instead of vertically on the road.
 frog can make upto m jumps
 etc etc.

 Regards
 Techie

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




-- 
Regards,
Ashish

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



Re: [algogeeks] Road crossing algorithm

2010-07-15 Thread Ashish kumar Jain
I think this will help:

http://en.wikipedia.org/wiki/Frogger

Consider the roads to be n-laned and of constant width with constant time
traffic coming on each lane.For example,say after 1 minute,a car comes on
each lane but in a arithmetic sequence and not all at same time.To make it
more clear,

at t=1 minute,car at lane 1 travelling with constant velocity v and takes
T time to cross the screen/lane1.

at t=2 minute,another car comes now in lane 2 with same constant velocity
and so on..

Now the frog can cross one lane either back or forth in one jump.These are
the only movements allowed.The jump time is considerable(say in above case 1
minute only).Note that times are all not correctly mentioned and consider
times which are appropriate for the problem.The time details are mentioned
to make everyone understand the problem.

Design an algorithm to guarantee that the frog crosses the road safely.

Think first..Hint is
downwards.
.
.
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.

Hint: Think in terms of multithreading,semaphores,mutex and vectors
etc..

On Wed, Jul 14, 2010 at 11:33 PM, Tech Id tech.login@gmail.com wrote:

 A frog has to cross a road to meet
 its beloved she-frog at the other end.

 The road however has cars coming and
 can crush the frog.

 Road is two lanes wide.

 Devise an algorithm to help the frog carry on its family.

 (I am sorry but it seems that I have missed
 some parts of the problem here. If someone
 remembers the complete question, please help me).
 Thanks in advance!

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




-- 
Regards,
Ashish

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



Re: [algogeeks] stack

2010-07-15 Thread Ashish kumar Jain
Another way in which this can be thought is in terms of Tower of Hanoi
problem.Just introduce two more stacks of same size as input stack and get
the sorted output as result.

On Mon, Jun 14, 2010 at 9:18 AM, Anurag Sharma anuragvic...@gmail.comwrote:

 Why not just pop all elements from stack ( O(n) )  and insert it in a self
 balancing Binary Search Tree (like RB Tree) (O(log(n) ) and then do and
 inorder traversal ( O(n) )and push elements in stack again.
 Time = O(nlog(n) + n)
 Space=O(n) (for storing the tree)

 Anurag Sharma



 On Sun, Jun 13, 2010 at 9:25 PM, Jitendra Kushwaha 
 jitendra.th...@gmail.com wrote:

 Stack can be sorted in O(n^2).

 @sankalp:
  Stack can always be sorted. Why do you think it cant be in some cases ?

 One can think like insertion sort
 algo :
 1. for i in (1,n)
   2. Pop up the top n-1 element and keep nth element in global variable
 say hold
   3. while pushing get the position for hold and push it there

 for loop will take O(n) and step 2 will take take O(n) time. So overall
 O(n^2) complexity
 Program can be done with recursion using a variable (hence O(1) space).
 But it will use system stack :)


 Any comments OR better solution is welcomed??

 --
 Regards
 Jitendra Kushwaha
 MNNIT, Allahabad

  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards,
Ashish

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



Re: [algogeeks] HIEGHT

2010-07-09 Thread Ashish kumar Jain
I made a mistake here.I traversed only the leftmost and the rightmost
branches.We need to use stack here.

On Fri, Jul 9, 2010 at 11:15 AM, Ashish kumar Jain
akjlucky4...@gmail.comwrote:

 Here is the Iterative function:

 //Function to compute height of a binary tree iteratively

 int GetHeight(struct node *root)
 {
   //NULL root check
   if(root==NULL)
return 0;

   int hl=0;   // Height of Left subtree
   int hr=0;   // Height of Right subtree
   struct node *templ=root;

   while(temp1  templ-left)
   {
  templ= templ-left;
  hl++;
   }

   while(root  root-right)
   {
  root=root-right;
  hr++;
   }

   return (hlhr ?(hl+1):(hr+1));
 }

 Thanks and Regards,
 Ashish


 On Thu, Jul 8, 2010 at 9:18 PM, jalaj jaiswal 
 jalaj.jaiswa...@gmail.comwrote:

 @ above he asked iterative .
 .. use a stack to eliminate recursion ...


 On Thu, Jul 8, 2010 at 9:00 PM, Anand anandut2...@gmail.com wrote:

 height(struct *node)
 {
   int left_height;
   int right_height;
   if(node == NULL)
 return 0;
  else
   left_height = height(node-left);
   right_height = height(node-right);
   return (1+ max(left_height, right_height));


 }

 On Thu, Jul 8, 2010 at 2:46 AM, sharad sharad20073...@gmail.com wrote:

 write algo to find hieght of BINARY tree ITERATIVELY

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 With Regards,
 Jalaj Jaiswal
 +919026283397
 B.TECH IT
 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 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.





-- 
ASHISH KUMAR JAIN
Engineer,P  T
CIENA,Gurgaon
Contacts:
Phone:- +919899668402
e-mail:
  ashish.jain.cs...@itbhu.ac.in
  akjlucky4...@gmail.com
  asj...@ciena.com

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



Re: [algogeeks] c

2010-06-26 Thread Ashish kumar Jain
This is a well known C Gotcha,to change a const variable will always lead to
error.

I guess the main query is Is this declaration valid and your compiler only
shows error at printf line and not in the declaration.It also states that
'x' is a read-only variable.

Hence,it accepts this declaration for read-only variable 'x'  which in this
case cannot be changed.

Regards,
Ashish

On Sat, Jun 26, 2010 at 11:09 AM, sharad kumar aryansmit3...@gmail.comwrote:

 pls c thz


 On Sat, Jun 26, 2010 at 10:48 AM, sharad kumar aryansmit3...@gmail.comwrote:

 cos if u declare const u cant change na.but volatile changes na.so
 practically u cant declareU cant do mtech at IIT and MBA at IIM at same
 time rite???


 On Sat, Jun 26, 2010 at 10:43 AM, sharad kumar 
 aryansmit3...@gmail.comwrote:

 no its not cos u have declared const and volatile hw is it possible
 can u go to IIT and IIM at same time

   On Sat, Jun 26, 2010 at 9:22 AM, sharad kumar 
 sharad20073...@gmail.com wrote:

 static const volatile int x;
 Is the declaration valid
 plzzz explain

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




 --
 yezhu malai vaasa venkataramana Govinda Govinda




 --
 yezhu malai vaasa venkataramana Govinda Govinda




 --
 yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] c array

2010-06-25 Thread Ashish kumar Jain
It is legal in ANSI C (and perhaps in a few pre-ANSI systems), though useful
only in rare circumstances.

This is running without any error on Dev cpp which has GCC compiler.It is
illegal in C++ where strict type checking is already in place.

If someone differs from me,please let me know how you ran this piece of
code.First thing should be that it is a pure .c file and not .cpp file.

Had it been not the case and you ran it in C++ environment,then it will
surely throw error for array bounds overflow.

Regards,

Ashish

On Sun, Jun 13, 2010 at 3:03 PM, sankalp srivastava 
richi.sankalp1...@gmail.com wrote:

 don't ever use a TC compiler , the most obsolete and mad compiler of all .
 Every compiler tries to fix the bug in ur code by some way or the other
 using some .Even gcc has a lot of bugs , in the sense it will return an exit
 status even if returning a void , but this is on ubuntu and haven't tries
 mingW yet . Any


 On Sun, Jun 13, 2010 at 1:47 PM, divya jain sweetdivya@gmail.comwrote:

 i use tc


 On 13 June 2010 13:11, ram karthik.gin...@gmail.com wrote:

 @rohit bro

 http://www.mingw.org/

 *MinGW*, a contraction of Minimalist GNU for Windows, is a port of the
 GNU Compiler Collection (GCC), and GNU Binutils, for use in the development
 of native Microsoft Windows applications.





 *From:* algogeeks@googlegroups.com [mailto:algoge...@googlegroups.com] *On
 Behalf Of *Rohit Saraf
 *Sent:* 13 June 2010 08:19

 *To:* algogeeks@googlegroups.com
 *Subject:* Re: [algogeeks] c array



 @ram : i guess you have used some longer string and not strings



 btw..  what is Mingw ?

 gcc/g++ is not mingw, i guess


 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14

 On Sun, Jun 13, 2010 at 8:13 AM, ram karthik.gin...@gmail.com wrote:

 D:\code\samplecode\main.cpp|5|error: initializer-string for array of
 chars is too long|



 I get this error on gcc (Mingw) .



 Though the array indexing starts from 0.

 The length specified in char str[7] is always straightforward . in this
 case char str[7]  . the length of str is seven not eight ;hence the error

 --

 ram



 *From:* algogeeks@googlegroups.com [mailto:algoge...@googlegroups.com] *On
 Behalf Of *sharad kumar
 *Sent:* 13 June 2010 07:59
 *To:* algogeeks@googlegroups.com
 *Subject:* Re: [algogeeks] c array



 hey array indexing starts from 0 rite??
 then y shld u get overflow in first place..
 s t  r  i n g s \0
 0 1 2 3 4 5 6 7

 On Sat, Jun 12, 2010 at 9:14 PM, divya sweetdivya@gmail.com wrote:

 #includestdio.h
 int main()
 {

 char str[7]=strings;
 printf(%s\n,str);
 return 0;
 }

 here i m nt getting overflow error whereas if i write stringss instead
 of strings then there is overflow error.. isnt null stored after s in
 strings nd 1st case shd also give overflow???

 --

 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.




 --
 yezhu malai vaasa venkataramana Govinda Govinda

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

 --

 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.

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

Re: [algogeeks] c array

2010-06-25 Thread Ashish kumar Jain
I also tried the same on Cygwin which has GCC and G++ compilers installed.It
also did not throw any error to me for .c file and threw the following error
for .cpp file:

$ g++ practice.cpp
practice.cpp: In function `int main()':
practice.cpp:4: error: initializer-string for array of chars is too long

I ran this piece of code on GCC compiler:

#includestdio.h
int main()
{
  char str[7]=strings;
  int i=printf(%s\n,str);
  printf(%d %d %d\n,i,sizeof(str)/sizeof(str[0]),strlen(str));
  return 0;
}

and it yielded:

kt...@akjlab /cygdrive/f/Code/linux
$ gcc practice.c

kt...@akjlab /cygdrive/f/Code/linux
$

kt...@akjlab /cygdrive/f/Code/linux
$

kt...@akjlab /cygdrive/f/Code/linux
$ ./a.exe
strings
8 7 7

Regards,

Ashish



On Fri, Jun 25, 2010 at 9:06 PM, Ashish kumar Jain
akjlucky4...@gmail.comwrote:

 It is legal in ANSI C (and perhaps in a few pre-ANSI systems), though
 useful only in rare circumstances.

 This is running without any error on Dev cpp which has GCC compiler.It is
 illegal in C++ where strict type checking is already in place.

 If someone differs from me,please let me know how you ran this piece of
 code.First thing should be that it is a pure .c file and not .cpp file.

 Had it been not the case and you ran it in C++ environment,then it will
 surely throw error for array bounds overflow.

 Regards,

 Ashish


 On Sun, Jun 13, 2010 at 3:03 PM, sankalp srivastava 
 richi.sankalp1...@gmail.com wrote:

 don't ever use a TC compiler , the most obsolete and mad compiler of all .
 Every compiler tries to fix the bug in ur code by some way or the other
 using some .Even gcc has a lot of bugs , in the sense it will return an exit
 status even if returning a void , but this is on ubuntu and haven't tries
 mingW yet . Any


 On Sun, Jun 13, 2010 at 1:47 PM, divya jain sweetdivya@gmail.comwrote:

 i use tc


 On 13 June 2010 13:11, ram karthik.gin...@gmail.com wrote:

 @rohit bro

 http://www.mingw.org/

 *MinGW*, a contraction of Minimalist GNU for Windows, is a port of
 the GNU Compiler Collection (GCC), and GNU Binutils, for use in the
 development of native Microsoft Windows applications.





 *From:* algogeeks@googlegroups.com [mailto:algoge...@googlegroups.com]
 *On Behalf Of *Rohit Saraf
 *Sent:* 13 June 2010 08:19

 *To:* algogeeks@googlegroups.com
 *Subject:* Re: [algogeeks] c array



 @ram : i guess you have used some longer string and not strings



 btw..  what is Mingw ?

 gcc/g++ is not mingw, i guess


 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14

 On Sun, Jun 13, 2010 at 8:13 AM, ram karthik.gin...@gmail.com wrote:

 D:\code\samplecode\main.cpp|5|error: initializer-string for array of
 chars is too long|



 I get this error on gcc (Mingw) .



 Though the array indexing starts from 0.

 The length specified in char str[7] is always straightforward . in this
 case char str[7]  . the length of str is seven not eight ;hence the error

 --

 ram



 *From:* algogeeks@googlegroups.com [mailto:algoge...@googlegroups.com]
 *On Behalf Of *sharad kumar
 *Sent:* 13 June 2010 07:59
 *To:* algogeeks@googlegroups.com
 *Subject:* Re: [algogeeks] c array



 hey array indexing starts from 0 rite??
 then y shld u get overflow in first place..
 s t  r  i n g s \0
 0 1 2 3 4 5 6 7

 On Sat, Jun 12, 2010 at 9:14 PM, divya sweetdivya@gmail.com
 wrote:

 #includestdio.h
 int main()
 {

 char str[7]=strings;
 printf(%s\n,str);
 return 0;
 }

 here i m nt getting overflow error whereas if i write stringss instead
 of strings then there is overflow error.. isnt null stored after s in
 strings nd 1st case shd also give overflow???

 --

 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.




 --
 yezhu malai vaasa venkataramana Govinda Govinda

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

 --

 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

Re: [algogeeks] c output

2010-06-11 Thread Ashish kumar Jain
Explanation:

 The prototype for printf as per ANSI C is:

*int printf( const char *format,…)*

the return value is integer and returns the number of characters
successfully read by printf.

Also,in case of printf(),the evaluation of expressions passed on as
arguments is done from right to left on stack and then printed from
left to right by popping the stack.

So,the output comes as:

c :Evaluation of printf(%c\n,b).Note that after execution,they
return the number of characters read.

1:  Evaluation of  printf(%d\n,a)

6,2 :No of characters read printed from left to right as printf now is:

printf(%d %d,6,2);

@Divya:Good question for clearing concepts related to printf.May i know the
source?





On Fri, Jun 11, 2010 at 9:26 AM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:

 c
 1
 6,2

 u might be expecting 5,1 if u are forgetting the newline character :)
 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14


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




-- 
ASHISH KUMAR JAIN
Engineer,P  T
CIENA,Gurgaon
Contacts:
Phone:- +919899668402
e-mail:
 ashish.jain.cs...@itbhu.ac.in
 akjlucky4...@gmail.com
 asj...@ciena.com

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