Re: [algogeeks] Algorithmic Pioneers

2011-06-24 Thread Vishnutej Mylavarapu
You can add AC Rush too..

On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty rajeevr...@gmail.comwrote:

 @ankit Thanks for the suggestion , I ahve Updated to include petr Mitrichev
 :)


 On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok ankit4...@gmail.comwrote:

 very nice man nice collection add Petr Mitrichev to this collection


 On Fri, Jun 24, 2011 at 11:14 AM, rShetty rajeevr...@gmail.com wrote:

 Collection of Algorithmic Pioneers can be Found here


 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-and.html

 Suggestion for addition of more Pioneers are welcome .

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




-- 

*-Vishnutej Mylavarapu.*

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

2011-06-24 Thread radha krishnan
Include Euler !!!

On Fri, Jun 24, 2011 at 12:11 PM, Vishnutej Mylavarapu 
mylavarapu.vishnu...@gmail.com wrote:

 You can add AC Rush too..


 On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty 
 rajeevr...@gmail.comwrote:

 @ankit Thanks for the suggestion , I ahve Updated to include petr
 Mitrichev :)


 On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok ankit4...@gmail.comwrote:

 very nice man nice collection add Petr Mitrichev to this collection


 On Fri, Jun 24, 2011 at 11:14 AM, rShetty rajeevr...@gmail.com wrote:

 Collection of Algorithmic Pioneers can be Found here


 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-and.html

 Suggestion for addition of more Pioneers are welcome .

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




 --

 *-Vishnutej Mylavarapu.*

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


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



Re: [algogeeks] [Brain Teaser] Sherlock puzzle 24 June

2011-06-24 Thread Vishal Thanki
she got killed because of suffocation :P

On Fri, Jun 24, 2011 at 12:35 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 sherlock puzzle Solution - 24 june

 A wife and her husband were driving in their car on the highway. All of a
 sudden, they ran out of gas. So the husband said to the wife, 'Now, you stay
 here. I will go down the highway to the nearest gas station, and I will be
 about 1 hour. Just listen to the radio and read some books, and remember to
 lock all the windows and doors. I will leave the keys with you.' So, off the
 husband went, and the wife first locked ALL the windows and doors. Next, she
 turned on the radio, and this is what she heard on the news report:

 'THERE IS A MURDERER ON THE LOOSE. HE WAS LAST SEEN ON THE HIGHWAY, WEARING
 ALL BLACK, ABOUT 5 FOOT 11 INCHES. PLEASE, BE AWARE AND CONTACT THE POLICE
 IMMEDIATELY.' The wife got very scared. She turned off the radio and double
 checked the locked doors. Then she saw the murderer, only a couple feet away
 from the car. An hour later, the husband returned to his car. Inside the
 car, his wife was DEAD, she had been murdered. All the windows were still
 locked, and the doors. No windows were broken, and the car was in PERFECT
 condition. No scratches or anything, it was the same way as when he left it.
 How did the murderer kill the wife?Yo dont need to be sherlock holmes to
 solve this ??

 Update Your Answers at : Click Here

 --

                     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.


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

2011-06-24 Thread Anika Jain
hm.. thanx everyone..

On Fri, Jun 24, 2011 at 2:43 AM, D!leep Gupta dileep.smil...@gmail.comwrote:

 #includestdio.h
 main()
 {
 long double *var;
 printf(%d,(char*)(var+1)-(char*)var);
 return 0;
 }

 This also may be the solution... by taking the pointer of that variable...

 On Fri, Jun 24, 2011 at 2:09 AM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 here is the generalized way


 #includestdio.h
 #define SIZEOF(var) (size_t)(var+1) - (size_t)(var)
 main()
 {
 double x;
  printf(The size of x is %d\n,SIZEOF(x));
 return 0;
 }

 On Fri, Jun 24, 2011 at 1:35 AM, Anika Jain anika.jai...@gmail.comwrote:

 #includestdio.h

 int main()
 {
 char x='9',size=0,count;
 while(x)
 {
 x = x1;
 count++;
 if((count=count%8)==0)
 {
 size++;
 }
 }
 printf(%d\n,size);
 return 0;
 }

 this code i tried to find size of a variable without using sizeof.. but
 its only for ints and chars... not general.. does anybody hava a general
 answer??

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




 --
   best wishes!!
 Vaibhav Shukla
 DU-MCA

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




 --
 Dileep Kumar
 B.Tech 3rd 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.


-- 
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] Sherlock puzzle 24 June

2011-06-24 Thread Anika Jain
she died out of shock or heart attack..

On Fri, Jun 24, 2011 at 12:46 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 she got killed because of suffocation :P

 On Fri, Jun 24, 2011 at 12:35 PM, Lavesh Rawat lavesh.ra...@gmail.com
 wrote:
  sherlock puzzle Solution - 24 june
 
  A wife and her husband were driving in their car on the highway. All of a
  sudden, they ran out of gas. So the husband said to the wife, 'Now, you
 stay
  here. I will go down the highway to the nearest gas station, and I will
 be
  about 1 hour. Just listen to the radio and read some books, and remember
 to
  lock all the windows and doors. I will leave the keys with you.' So, off
 the
  husband went, and the wife first locked ALL the windows and doors. Next,
 she
  turned on the radio, and this is what she heard on the news report:
 
  'THERE IS A MURDERER ON THE LOOSE. HE WAS LAST SEEN ON THE HIGHWAY,
 WEARING
  ALL BLACK, ABOUT 5 FOOT 11 INCHES. PLEASE, BE AWARE AND CONTACT THE
 POLICE
  IMMEDIATELY.' The wife got very scared. She turned off the radio and
 double
  checked the locked doors. Then she saw the murderer, only a couple feet
 away
  from the car. An hour later, the husband returned to his car. Inside the
  car, his wife was DEAD, she had been murdered. All the windows were still
  locked, and the doors. No windows were broken, and the car was in PERFECT
  condition. No scratches or anything, it was the same way as when he left
 it.
  How did the murderer kill the wife?Yo dont need to be sherlock holmes to
  solve this ??
 
  Update Your Answers at : Click Here
 
  --
 
  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.
 

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



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



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

2011-06-24 Thread alok kediya
any one downloaded or having link to download link, plz share it with me..
thanks in advance :)

Thanks,
Alok

On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 mail it to me plz..

 agr.bhav...@gmail.com

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


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



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

2011-06-24 Thread murthy.krishn...@gmail.com
yaa If any one has it, can you please mail it to me also

Thanks,

On Fri, Jun 24, 2011 at 2:36 PM, alok kediya alokked...@gmail.com wrote:

 any one downloaded or having link to download link, plz share it with me..
 thanks in advance :)

 Thanks,
 Alok

 On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal 
 agr.bhav...@gmail.comwrote:

 mail it to me plz..

 agr.bhav...@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.




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

-- 
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] Queue to support insert , delete, find max in o(1)

2011-06-24 Thread ross
Hi,
I know that a stack can be modified with another stack to support push
pop min in const time.
Design a FIFO data structure to support ins, del, and find min in
O(1). Extra space allowed.

-- 
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] Queue to support insert , delete, find max in o(1)

2011-06-24 Thread Piyush Sinha
Can we use circular linked list with each new inserted node keeping track of
the minimum before it??


On Fri, Jun 24, 2011 at 3:20 PM, ross jagadish1...@gmail.com wrote:

 Hi,
 I know that a stack can be modified with another stack to support push
 pop min in const time.
 Design a FIFO data structure to support ins, del, and find min in
 O(1). Extra space allowed.

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




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

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



[algogeeks] Re: Queue to support insert , delete, find max in o(1)

2011-06-24 Thread ross
@piyush,
Dude, how will that make findmin() to be O(1) because, once the
minimum element is
deleted, u would require changes in the others .. Correct me if i am
wrong..
Eg:
consider inserting, 1 5 6 7 9 in order into the circular LL.
When u make each node keep track of the minm before it, all will
retain 1 as minm..

Now consider deleting 1. how will that affect the rest of the list?

On Jun 24, 3:07 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 Can we use circular linked list with each new inserted node keeping track of
 the minimum before it??









 On Fri, Jun 24, 2011 at 3:20 PM, ross jagadish1...@gmail.com wrote:
  Hi,
  I know that a stack can be modified with another stack to support push
  pop min in const time.
  Design a FIFO data structure to support ins, del, and find min in
  O(1). Extra space allowed.

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

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

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



Re: [algogeeks] Re: Queue to support insert , delete, find max in o(1)

2011-06-24 Thread Piyush Sinha
ohh sorry, my bad..I missed that issue...then we can use the same logic
of using one more stack that we use for implementing modified stack keeping
track of the min()..I hope this will solve the issue

On Fri, Jun 24, 2011 at 3:57 PM, ross jagadish1...@gmail.com wrote:

 @piyush,
 Dude, how will that make findmin() to be O(1) because, once the
 minimum element is
 deleted, u would require changes in the others .. Correct me if i am
 wrong..
 Eg:
 consider inserting, 1 5 6 7 9 in order into the circular LL.
 When u make each node keep track of the minm before it, all will
 retain 1 as minm..

 Now consider deleting 1. how will that affect the rest of the list?

 On Jun 24, 3:07 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
  Can we use circular linked list with each new inserted node keeping track
 of
  the minimum before it??
 
 
 
 
 
 
 
 
 
  On Fri, Jun 24, 2011 at 3:20 PM, ross jagadish1...@gmail.com wrote:
   Hi,
   I know that a stack can be modified with another stack to support push
   pop min in const time.
   Design a FIFO data structure to support ins, del, and find min in
   O(1). Extra space allowed.
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926*

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




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

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



[algogeeks] Re: Algorithmic Pioneers

2011-06-24 Thread rShetty
I Have Updated :)

On Jun 24, 11:45 am, radha krishnan radhakrishnance...@gmail.com
wrote:
 Include Euler !!!

 On Fri, Jun 24, 2011 at 12:11 PM, Vishnutej Mylavarapu 







 mylavarapu.vishnu...@gmail.com wrote:
  You can add AC Rush too..

  On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty 
  rajeevr...@gmail.comwrote:

  @ankit Thanks for the suggestion , I ahve Updated to include petr
  Mitrichev :)

  On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok ankit4...@gmail.comwrote:

  very nice man nice collection add Petr Mitrichev to this collection

  On Fri, Jun 24, 2011 at 11:14 AM, rShetty rajeevr...@gmail.com wrote:

  Collection of Algorithmic Pioneers can be Found here

 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-an...

  Suggestion for addition of more Pioneers are welcome .

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

  --

  *-Vishnutej Mylavarapu.*

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

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



[algogeeks] can void pointer be incremented

2011-06-24 Thread himanshu kansal
can v increment d void pointer
its perfectly valid on gcc
bt it gives me an error on vc
so is it allowed by c standard or its an extension provided by gnu???

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



[algogeeks] Re: can void pointer be incremented

2011-06-24 Thread himanshu kansal
one more...gcc allows void ptr to be assigned to and frm any type of ptr w/o
any cast
bt vc gvs an error and requires an explicit cast...
whots d specifications abt ds as conforming to c standards..
On Fri, Jun 24, 2011 at 6:25 PM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 can v increment d void pointer
 its perfectly valid on gcc
 bt it gives me an error on vc
 so is it allowed by c standard or its an extension provided by gnu???




-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of Delhi)

-- 
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] O(n) Time is the problem. ..

2011-06-24 Thread Liang Ge
Sure, if only one number is missing and all the other numbers are distinct.
And we know those numbers are from 1 to n. First we xor all the numbers, we
get xor1, then we let xor1 xor with numbers from 1 to n. Since xor means 1
xor 1=0, then all the number appear in the file will null out (those bits
are set to 0). The bits left that are 1 in xor1 must be the missing
number.Noted that this method has three assumptions



On Thu, Jun 23, 2011 at 9:21 AM, Sriganesh Krishnan 2448...@gmail.comwrote:

 can you explain mewhat the logic is...behind the xor operation?...is it
 like inversion or encryption?

 On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 initially compute xor of all the values from 0 to n in a variable Temp
 so temp = 0^1^2^n
 let result is used to store the missing number
 for each ith bit of missing number where i = 0-31 we can find it as
 following
 ith bit of result = (xor of all ith bits of values of array) xored with
 (ith
 bit of temp)

 On Thu, Jun 23, 2011 at 12:25 AM, oppilas . jatka.oppimi...@gmail.comwrote:

 Is the array sorted?
 In A[1..n], one number is missing from 0 to N. So,
 A[5]={--INF, 2,1,3,0} is a valid case?


 On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.com wrote:

 An array A[1...n] contains all the integers from 0 to n except for one
 number which is
 missing. In this problem, we cannot access an entire integer in A with
 a single opera-
 tion. The elements of A are represented in binary, and the only
 operation we can use
 to access them is “fetch the jth bit of A[i]”, which takes constant
 time. Write code to
   find the missing integer. Can you do it in O(n) time?
  _
  _ _

 Rajeev N Bharshetty
 I Blog @ www.opensourcemania.co.cc

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




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


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

2011-06-24 Thread rizwan hudda
Add Donald Knuth, Rajeev Motwani, Manindra agrawal, Richard Karp, Vijay V
Vazirani to the list.
Peter is no doubt a great algorithm champion, and so is ACRush. But they are
definetely not the
pioneers of the algorithms field, you can probably remove them from list of
pioneers.

Thanks,
Rizwan.
On Fri, Jun 24, 2011 at 12:15 PM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 Include Euler !!!


 On Fri, Jun 24, 2011 at 12:11 PM, Vishnutej Mylavarapu 
 mylavarapu.vishnu...@gmail.com wrote:

 You can add AC Rush too..


 On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty rajeevr...@gmail.com
  wrote:

 @ankit Thanks for the suggestion , I ahve Updated to include petr
 Mitrichev :)


 On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok ankit4...@gmail.comwrote:

 very nice man nice collection add Petr Mitrichev to this collection


 On Fri, Jun 24, 2011 at 11:14 AM, rShetty rajeevr...@gmail.com wrote:

 Collection of Algorithmic Pioneers can be Found here


 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-and.html

 Suggestion for addition of more Pioneers are welcome .

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




 --

 *-Vishnutej Mylavarapu.*

  --
 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 and regards
Rizwan A Hudda
http://sites.google.com/site/rizwanhudda

-- 
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] O(n) Time is the problem. ..

2011-06-24 Thread rizwan hudda
@sunny: Think again, your solution will take O(n*log(n)), where log(n) is
the number of bits to represent
the number.

On Thu, Jun 23, 2011 at 6:51 PM, Sriganesh Krishnan 2448...@gmail.comwrote:

 can you explain mewhat the logic is...behind the xor operation?...is it
 like inversion or encryption?


 On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 initially compute xor of all the values from 0 to n in a variable Temp
 so temp = 0^1^2^n
 let result is used to store the missing number
 for each ith bit of missing number where i = 0-31 we can find it as
 following
 ith bit of result = (xor of all ith bits of values of array) xored with
 (ith
 bit of temp)

 On Thu, Jun 23, 2011 at 12:25 AM, oppilas . jatka.oppimi...@gmail.comwrote:

 Is the array sorted?
 In A[1..n], one number is missing from 0 to N. So,
 A[5]={--INF, 2,1,3,0} is a valid case?


 On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.com wrote:

 An array A[1...n] contains all the integers from 0 to n except for one
 number which is
 missing. In this problem, we cannot access an entire integer in A with
 a single opera-
 tion. The elements of A are represented in binary, and the only
 operation we can use
 to access them is “fetch the jth bit of A[i]”, which takes constant
 time. Write code to
   find the missing integer. Can you do it in O(n) time?
  _
  _ _

 Rajeev N Bharshetty
 I Blog @ www.opensourcemania.co.cc

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




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




-- 
Thanks and regards
Rizwan A Hudda
http://sites.google.com/site/rizwanhudda

-- 
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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-06-24 Thread rizwan hudda
I have bought the book myself a week back. It is worth the money.
A good collection different types of problems, and also it has a section for
design problems
for some practical applications.

You can buy its paper back edition from www.pothi.com for low cost (600
bucks)

On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 mail it to me plz..

 agr.bhav...@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.




-- 
Thanks and regards
Rizwan A Hudda
http://sites.google.com/site/rizwanhudda

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



Re: [algogeeks] c doubt

2011-06-24 Thread Anika Jain
ya i got it.. thanx

On Thu, Jun 23, 2011 at 6:01 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 It is because of the ! operator in front of a , !a is always 0(in case a is
 value other than 0) so it takes it as integer and hence the size is 4 bytes
 whereas only a you will get 12 . The ! changes the data type here .
 Hope it clears the doubt :)


 -


 Rajeev N B

 I Blog @ www.opensourcemania.co.cc

 On Thu, Jun 23, 2011 at 5:52 PM, Anika Jain anika.jai...@gmail.comwrote:

 int main()
 {
 long double a;
 signed char b;
 printf(%d\n,sizeof(!a+b));
 return 0;
 }

 why is it 4?? shouldnt it be 12 as per sizeof long double in gccc

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


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


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



Re: [algogeeks] Re: Segmentation fault

2011-06-24 Thread rizwan hudda
Saurabh: Your Circular list approach will not run in the time constraints
for this problem. Try solving it on SPOJ.

On Fri, Jun 24, 2011 at 10:50 AM, saurabh singh saurab...@gmail.com wrote:


 @anonymous populate the array first.Use bottom up approach rather than
 top down approach.

  --
 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 and regards
Rizwan A Hudda
http://sites.google.com/site/rizwanhudda

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



[algogeeks] Re: Google Question

2011-06-24 Thread sankalp srivastava
1,2,43,41,5 , 6
Start at a[3] and a[5] Swap them up .
Reversing it , we get
1,2,43,5,6,41
This does not work
 .
On Jun 23, 9:05 pm, Swathi chukka.swa...@gmail.com wrote:
 We just need to find the start and end of the decreasing sequence then we
 have to reverse the elements in that decreasing sequence by swapping the
 elements at both the edges...

 On Thu, Jun 23, 2011 at 2:13 PM, sankalp srivastava 



 richi.sankalp1...@gmail.com wrote:
  @piyush Sinha

  How can you do it in O(1) space and O(n) time dude .The inplace
  merging of d sorted arrays take space O(log d) space at least i
  think .Plus even at every step , we have to do O(log n) comparisions
  to find the next larger or smaller element .How can this be O(n) ???

  WAiting eagerly for a reply
  On Jun 22, 3:24 pm, Dumanshu duman...@gmail.com wrote:
   @Piyush: could u plz post the link to the same?

   On Jun 22, 2:15 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:

This question has been discussed over here once...It was concluded
that this can be solved in O(n) if we know there is a fixed range up
to which the elements keep on increasing and decreasing..for example
in an array of 12 elements, we know 3 elements keep on increasing
monotonically, then 3 elements keep on decreasing monotonically and so
on

On 6/22/11, chirag ahuja sparkle.chi...@gmail.com wrote:

 Given an array of size n wherein elements keep on increasing
 monotonically upto a certain location after which they keep on
 decreasing monotonically, then again keep on increasing, then
 decreasing again and so on. Sort the array in O(n) and O(1).

 I didn't understand the question, any array of n elements will be
  like
 this except when first there is a decrese from index 0 to a higher
 index. Any ideas about how to solve it in given constraints??

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

--
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926*-Hidequoted
  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.- 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.



[algogeeks] Re: c code help

2011-06-24 Thread sankalp srivastava
@ankit agarwal , it is giving zero because the region the pages are
allocated for it in the .rodata section (With pointer to it pushed on
the stack) is zeroed out .It can even give segmentation fault in many
cases and the behaviour here in operating system and compiler
dependent

On Jun 23, 5:14 pm, Anika Jain anika.jai...@gmail.com wrote:
 oki.. thanx :)

 On Thu, Jun 23, 2011 at 5:39 PM, Ankit Agarwal ankitgeniu...@gmail.comwrote:



  1) p1[-3] is an invalid address and thereby, it is giving 0.

  2) p1[3]='e' having 101 as ASCII value, thus -p1[3]=-101 as integer.

  On Thu, Jun 23, 2011 at 5:36 PM, Anika Jain anika.jai...@gmail.comwrote:

  1)
  int main()
  {
      char *p1=cquestionbank;
      printf(%d,p1[-3]);
      return 0;
  }

  why is it giving 0??

  2)
  int main()
  {
      char *p1=cquestionbank;
      printf(%d,-3[p1]);
      return 0;
  }

  why is this giving -101??

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

  --
  Ankit Agarwal

  *Be the change that you want to see in the world... :)*
  *- Gandhiji*

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



[algogeeks] Re: can void pointer be incremented

2011-06-24 Thread RITESH SRIVASTAV
C standard doesn't say anything about void pointer increment.
If you will do sizeof(void) ,I guess your gcc compiler will give you 1
as output.
In C, for compatibility with the old implementation (where void * were
used in place of char * and vice-versa)
doing this will not result in error on some compilers.
Result is undefined and you should avoid depending upon them.


On Jun 24, 6:01 pm, himanshu kansal himanshukansal...@gmail.com
wrote:
 one more...gcc allows void ptr to be assigned to and frm any type of ptr w/o
 any cast
 bt vc gvs an error and requires an explicit cast...
 whots d specifications abt ds as conforming to c standards..
 On Fri, Jun 24, 2011 at 6:25 PM, himanshu kansal 

 himanshukansal...@gmail.com wrote:
  can v increment d void pointer
  its perfectly valid on gcc
  bt it gives me an error on vc
  so is it allowed by c standard or its an extension provided by gnu???

 --

       Regards
 Himanshu Kansal
   Msc Comp. sc.
 (University of Delhi)

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



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

2011-06-24 Thread cooks
addToMailList(rohit.wali...@gmail.com);
:)

On Jun 24, 2:08 pm, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
 yaa If any one has it, can you please mail it to me also

 Thanks,



 On Fri, Jun 24, 2011 at 2:36 PM, alok kediya alokked...@gmail.com wrote:
  any one downloaded or having link to download link, plz share it with me..
  thanks in advance :)

  Thanks,
  Alok

  On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal 
  agr.bhav...@gmail.comwrote:

  mail it to me plz..

  agr.bhav...@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.

 --
 P.V.N.S.S. Krishna Murthy,
 Intern at Broadcom Private Limited,
 Bangalore,
 Contact no:- +919845812996.

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



[algogeeks] Re: can void pointer be incremented

2011-06-24 Thread rShetty
http://techbrother.blogspot.com/2007/11/incrementing-void-pointer.html

Regards

Rajeev N B

On Jun 24, 6:29 pm, RITESH SRIVASTAV riteshkumar...@gmail.com wrote:
 C standard doesn't say anything about void pointer increment.
 If you will do sizeof(void) ,I guess your gcc compiler will give you 1
 as output.
 In C, for compatibility with the old implementation (where void * were
 used in place of char * and vice-versa)
 doing this will not result in error on some compilers.
 Result is undefined and you should avoid depending upon them.

 On Jun 24, 6:01 pm, himanshu kansal himanshukansal...@gmail.com
 wrote:







  one more...gcc allows void ptr to be assigned to and frm any type of ptr w/o
  any cast
  bt vc gvs an error and requires an explicit cast...
  whots d specifications abt ds as conforming to c standards..
  On Fri, Jun 24, 2011 at 6:25 PM, himanshu kansal 

  himanshukansal...@gmail.com wrote:
   can v increment d void pointer
   its perfectly valid on gcc
   bt it gives me an error on vc
   so is it allowed by c standard or its an extension provided by gnu???

  --

        Regards
  Himanshu Kansal
    Msc Comp. sc.
  (University of Delhi)

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

2011-06-24 Thread abhijith reddy
+1

On Fri, Jun 24, 2011 at 1:06 PM, rizwan hudda rizwanhu...@gmail.com wrote:

 Add Donald Knuth, Rajeev Motwani, Manindra agrawal, Richard Karp, Vijay V
 Vazirani to the list.
 Peter is no doubt a great algorithm champion, and so is ACRush. But they
 are definetely not the
 pioneers of the algorithms field, you can probably remove them from list of
 pioneers.

 Thanks,
 Rizwan.
 On Fri, Jun 24, 2011 at 12:15 PM, radha krishnan 
 radhakrishnance...@gmail.com wrote:

 Include Euler !!!


 On Fri, Jun 24, 2011 at 12:11 PM, Vishnutej Mylavarapu 
 mylavarapu.vishnu...@gmail.com wrote:

 You can add AC Rush too..


 On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty 
 rajeevr...@gmail.com wrote:

 @ankit Thanks for the suggestion , I ahve Updated to include petr
 Mitrichev :)


 On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok ankit4...@gmail.comwrote:

 very nice man nice collection add Petr Mitrichev to this collection


 On Fri, Jun 24, 2011 at 11:14 AM, rShetty rajeevr...@gmail.comwrote:

 Collection of Algorithmic Pioneers can be Found here


 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-and.html


 Suggestion for addition of more Pioneers are welcome .

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




 --

 *-Vishnutej Mylavarapu.*

  --
 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 and regards
 Rizwan A Hudda
 http://sites.google.com/site/rizwanhudda



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


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



Re: [algogeeks] O(n) Time is the problem. ..

2011-06-24 Thread sunny agrawal
hmm i also doubt that
but it is Strictly O(32n) not O(nlgn) where lgn = 32 depending upon value
of n


On Fri, Jun 24, 2011 at 1:10 PM, rizwan hudda rizwanhu...@gmail.com wrote:

 @sunny: Think again, your solution will take O(n*log(n)), where log(n) is
 the number of bits to represent
 the number.


 On Thu, Jun 23, 2011 at 6:51 PM, Sriganesh Krishnan 2448...@gmail.comwrote:

 can you explain mewhat the logic is...behind the xor operation?...is
 it like inversion or encryption?


 On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 initially compute xor of all the values from 0 to n in a variable Temp
 so temp = 0^1^2^n
 let result is used to store the missing number
 for each ith bit of missing number where i = 0-31 we can find it as
 following
 ith bit of result = (xor of all ith bits of values of array) xored with
 (ith
 bit of temp)

 On Thu, Jun 23, 2011 at 12:25 AM, oppilas . 
 jatka.oppimi...@gmail.comwrote:

 Is the array sorted?
 In A[1..n], one number is missing from 0 to N. So,
 A[5]={--INF, 2,1,3,0} is a valid case?


 On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.comwrote:

 An array A[1...n] contains all the integers from 0 to n except for one
 number which is
 missing. In this problem, we cannot access an entire integer in A with
 a single opera-
 tion. The elements of A are represented in binary, and the only
 operation we can use
 to access them is “fetch the jth bit of A[i]”, which takes constant
 time. Write code to
   find the missing integer. Can you do it in O(n) time?
  _
  _ _

 Rajeev N Bharshetty
 I Blog @ www.opensourcemania.co.cc

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




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




 --
 Thanks and regards
 Rizwan A Hudda
 http://sites.google.com/site/rizwanhudda



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




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



Re: [algogeeks] Re: c query

2011-06-24 Thread rajeev bharshetty
@ T3rminal That is because the term is resolved as 2[*arr] which is pointing
to the structure variable 'c' of type 'job' So 'n' format specifiers should
be used to print n values of a structure and that to in sequence of
declarations in the structure .


Hope this helps :)


Regards


Rajeev N B

I Blog @ www.opensourcemania.co.cc

On Fri, Jun 24, 2011 at 4:10 AM, T3rminal piyush@gmail.com wrote:

 How  printf can print 2 values for %s and %f if you provided only 1
 (3,x1)[*arr] ?

 On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote:
  #includestdio.h
  typedef struct
  {
char *name;
 double salary;}job;
 
  main()
  {
  static job a={tcs,15000.0};
  static job b={ibm,25000.0};
  static job c={google,35000.0};
  int x=5;
  job *arr[3]={a,b,c};
   printf(%s %f\t,(3,x1)[*arr]);
 
  }
 
  it is giving google 35000.00 there's no error.. i think u r doing
 some
  mistake by not writing %s as format specifier in printing..
  On Thu, Jun 23, 2011 at 8:20 AM, Piyush Sinha ecstasy.piy...@gmail.com
 wrote:
 
 
 
 
 
 
 
   even I am getting output as google 0.0
 
   On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote:
i got (null) 0.0 on my gcc compiler , is there any syntax error
 
--
You received this message because you are subscribed to the Google
 Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
   --
   *Piyush Sinha*
   *IIIT, Allahabad*
   *+91-8792136657*
   *+91-7483122727*
   *https://www.facebook.com/profile.php?id=10655377926*
 
   --
You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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



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



Re: [algogeeks] Explain this.....

2011-06-24 Thread oppilas .
Please see this.
http://ideone.com/ZM74d
http://ideone.com/ZM74dI tried to print by directly giving 2[*arr] still
it's giving null and 0.000.
Can anyone think of a possible reason?

On Fri, Jun 24, 2011 at 12:55 AM, richa mahajan m.rich...@gmail.com wrote:

 i think it ll be compiler dependent becoz comma acts as a sequence pooint
 but not in function calls so semi colon here is a sequnce point and d value
 of an object (ptr here) is being modified more than once (between two seq
 points ) so this is undefined behavior..output will b compiler dependent


 On Wed, Jun 22, 2011 at 5:55 PM, udit sharma sharmaudit...@gmail.comwrote:

 #includestdio.h
 int main()
 {
 void print(int *,int *,int *,int *,int *);
 static int arr[]={97,98,99,100,101,102,103,104};
 int *ptr=arr+1;
 print(++ptr,ptr--,ptr,ptr++,++ptr);
 return 0;
 }
 void print(int *a,int *b,int *c,int *d,int *e)
 {
 printf(%d\t%d\t%d\t%d\t%d\n,*a,*b,*c,*d,*e);
 }

 Why the output is:
 10010010099100


 --
 Regards
  UDIT
  DU- MCA

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


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


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



[algogeeks] Re: Sherlock puzzle 24 June

2011-06-24 Thread sarveswaran v
she might died because of heat generated inside the car

-- 
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] Explain this.....

2011-06-24 Thread oppilas .
Sorry. Ignore the last message of mine. It does not belong to this thread.
:)

On Fri, Jun 24, 2011 at 8:37 PM, oppilas . jatka.oppimi...@gmail.comwrote:

 Please see this.
 http://ideone.com/ZM74d
 http://ideone.com/ZM74dI tried to print by directly giving 2[*arr] still
 it's giving null and 0.000.
 Can anyone think of a possible reason?


 On Fri, Jun 24, 2011 at 12:55 AM, richa mahajan m.rich...@gmail.comwrote:

 i think it ll be compiler dependent becoz comma acts as a sequence pooint
 but not in function calls so semi colon here is a sequnce point and d value
 of an object (ptr here) is being modified more than once (between two seq
 points ) so this is undefined behavior..output will b compiler dependent


 On Wed, Jun 22, 2011 at 5:55 PM, udit sharma sharmaudit...@gmail.comwrote:

 #includestdio.h
 int main()
 {
 void print(int *,int *,int *,int *,int *);
 static int arr[]={97,98,99,100,101,102,103,104};
 int *ptr=arr+1;
 print(++ptr,ptr--,ptr,ptr++,++ptr);
 return 0;
 }
 void print(int *a,int *b,int *c,int *d,int *e)
 {
 printf(%d\t%d\t%d\t%d\t%d\n,*a,*b,*c,*d,*e);
 }

 Why the output is:
 10010010099100


 --
 Regards
  UDIT
  DU- MCA

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


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




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



[algogeeks] URGENT Requirerment for Jr. SAN Storage Administrator in Tallahassee, FL 9+ Months

2011-06-24 Thread Aakif - Gain America, Inc.
Hello, 

 

We have a hot opening for...

 

Job Title: Jr. SAN Storage Administrator

Location: Tallahassee, FL

Duration: 9+ Months 

 

Must Need:

. Dell EMC (CX series storage) administration, maintenance,
upgrading, provisioning and management experience.

. Administration, maintenance, upgrading, provisioning and
management experience of the following.

o   VMWare

o   Windows Server experience

o   Disaster Recovery Planning and Testing

o   Citrix

o   Backups - Symantec Backup Exec, Symantec Puredisk, VMware virtual server
backups

 

Job profile:

 

This position will be responsible for managing  servers and storage in a
varied enterprise application server environment. This is a technical
position which is responsible for all maintenance associated with assigned
servers and storage relating to department application server environments.
This includes installation of software and hardware, monitoring, capacity
planning, documentation, customer service, patching, configuration, and
technical analysis. This is a lead technical position which will frequently
be requested to evaluate technical architecture at an enterprise level in
great depth.  

 

Please send me your Updated Resume and these details ASAP:  

 

Full Name: 

Contact No:

E-mail ID: 

Availability:

Visa Status/Citizenship:

Current Location:

Rate or Employer Details:

 

Regards,
Sam

Gain America, Inc. I 13804 Hull Street Road Midlothian, VA 23112
Direct: 703-828-7351 S:703-880-8775I Fax: 917-475-8362 I s...@gainam.net I
roysam_1...@yahoo.in I

P Please consider the environment before printing this e-mail.

  _  

 

-- 
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] URGENT Requirerment for Sr. OBBIE Developer in Minapolis, MN 6-12+ Months

2011-06-24 Thread Aakif - Gain America, Inc.
 

 

Hello, 

 

We have a hot opening for...

 

Job Title: Sr. OBBIE Developer

Location: Minapolis, MN

Duration: 6-12+ Months 

 

Required:

I need an OBIEE developer who knows the OBIEE report repository.  

Knowing Informatica and DAC would be bonus. 

Excellent Communication skills

 

Please send me your Updated Resume and these details ASAP:  

 

Full Name: 

Contact No:

E-mail ID: 

Availability:

Visa Status/Citizenship:

Current Location:

Rate or Employer Details:

 

Regards,

Sam

Gain America, Inc. I 13804 Hull Street Road Midlothian, VA 23112
Direct: 703-828-7351 S:703-880-8775I Fax: 917-475-8362 I s...@gainam.net I
roysam_1...@yahoo.in I

P Please consider the environment before printing this e-mail.

  _  

 

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



[algogeeks] Re: Algorithmic Pioneers

2011-06-24 Thread Dave
Add John von Neumann, for Gaussian Elimination.
Cooley and Tukey for the Fast Fourier Transform.
Jim Wilkinson, for error analysis in floating point arithmetic.

Dave

On Jun 24, 12:44 am, rShetty rajeevr...@gmail.com wrote:
 Collection of Algorithmic Pioneers can be Found here

 http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-an...

 Suggestion for addition of more Pioneers are welcome .

-- 
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] URGENT Requirerment for Sr. Java/ J2EE Developer in Raleigh, NC 3-6+ Months

2011-06-24 Thread Aakif - Gain America, Inc.
 

Hello, 

 

We have a hot opening for...

 

Job Title: Sr. Java/ J2EE Developer

Location: Raleigh, NC

Duration: 3-6+ Months 

 

Job Description:

Our client is looking for a Sr. Java Developer. The candidate will be
completing server side development (backend development) on an upgrade to an
existing Web Services based application. The application will support
clients allowing multi-system integration of data. Day to day They will
provide standards based software solutions produced in an Agile methodology
with products delivered every two weeks. This position will serve as the
sole developer on this project. 

 

Must-haves:

- 7-10 years of java development experience 
- Work in a fast paced environment with a small team 
- Proficiency in server side Java development 
- Experience with open source development tools 

***Experience with Spring, Hibernate, Web Services ***
- Experience developing enterprise class applications 
- Experience with JMS 

 

Preefered Skills: 

- Utility industry knowledge 
- iBatis 
- Camel 
-JUnit Testing 

 

Please send me your Updated Resume and these details ASAP:  

 

Full Name: 

Contact No:

E-mail ID: 

Availability:

Visa Status/Citizenship:

Current Location:

Rate or Employer Details:

 

Regards,
Sam

Gain America, Inc. I 13804 Hull Street Road Midlothian, VA 23112
Direct: 703-828-7351 S:703-880-8775I Fax: 917-475-8362 I s...@gainam.net I
roysam_1...@yahoo.in I

P Please consider the environment before printing this e-mail.

  _  

 

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

2011-06-24 Thread Decipher
Can anybody please explain how to solve this question with logarithmic
time complexity ?

Write the code/algorithm to find the k-th Smallest Element in the
Union of Two Sorted Arrays .

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

2011-06-24 Thread Anantha Krishnan
Check this http://ideone.com/C8fQC

http://ideone.com/C8fQCThanks  Regards,
Anantha Krishnan

On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.com wrote:

 Can anybody please explain how to solve this question with logarithmic
 time complexity ?

 Write the code/algorithm to find the k-th Smallest Element in the
 Union of Two Sorted Arrays .

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



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



Re: [algogeeks] C Error

2011-06-24 Thread hary rathor
actually
?:  operation have more precedence then =
so it evaluate first ,to 10
in next pass it become 10=10 ; which is illegal cause of  (=) operator
required a variable left side but
is present hence error cause lvalue required .

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

2011-06-24 Thread oppilas .
Please see this.
http://ideone.com/ZM74d
http://ideone.com/ZM74dI tried to print by directly giving 2[*arr] still
it's giving null and 0.000.
Can anyone think of a possible reason?

On Fri, Jun 24, 2011 at 8:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 @ T3rminal That is because the term is resolved as 2[*arr] which is
 pointing to the structure variable 'c' of type 'job' So 'n' format
 specifiers should be used to print n values of a structure and that to in
 sequence of declarations in the structure .


 Hope this helps :)


 Regards


 Rajeev N B

 I Blog @ www.opensourcemania.co.cc

 On Fri, Jun 24, 2011 at 4:10 AM, T3rminal piyush@gmail.com wrote:

 How  printf can print 2 values for %s and %f if you provided only 1
 (3,x1)[*arr] ?

 On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote:
  #includestdio.h
  typedef struct
  {
char *name;
 double salary;}job;
 
  main()
  {
  static job a={tcs,15000.0};
  static job b={ibm,25000.0};
  static job c={google,35000.0};
  int x=5;
  job *arr[3]={a,b,c};
   printf(%s %f\t,(3,x1)[*arr]);
 
  }
 
  it is giving google 35000.00 there's no error.. i think u r doing
 some
  mistake by not writing %s as format specifier in printing..
  On Thu, Jun 23, 2011 at 8:20 AM, Piyush Sinha ecstasy.piy...@gmail.com
 wrote:
 
 
 
 
 
 
 
   even I am getting output as google 0.0
 
   On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote:
i got (null) 0.0 on my gcc compiler , is there any syntax error
 
--
You received this message because you are subscribed to the Google
 Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
   --
   *Piyush Sinha*
   *IIIT, Allahabad*
   *+91-8792136657*
   *+91-7483122727*
   *https://www.facebook.com/profile.php?id=10655377926*
 
   --
You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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


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


-- 
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] SET IN C

2011-06-24 Thread hary rathor
Can anyone suggest me how to implement  a set in c .
It means that it should take  O(1)  in insertion, deletion , finding element





-- 
Harish Pranami
Master Of Computer Application ,
Deptt of computer Science,
north campus , university of delhi,
New Delhi   pin no - 110007

-- 
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: Sherlock puzzle 24 June

2011-06-24 Thread hary rathor
cause of smothering ...

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

2011-06-24 Thread hary rathor
[] has higher precedence then ( - ) operator thereby it take element first
and make it to negative

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



Re: [algogeeks] SET IN C

2011-06-24 Thread pacific :-)
Disjoint set data structure.

Refer cormen.

On Fri, Jun 24, 2011 at 10:36 PM, hary rathor harry.rat...@gmail.comwrote:


 Can anyone suggest me how to implement  a set in c .
 It means that it should take  O(1)  in insertion, deletion , finding
 element





 --
 Harish Pranami
 Master Of Computer Application ,
 Deptt of computer Science,
 north campus , university of delhi,
 New Delhi   pin no - 110007


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

-- 
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] Writing good code in interviews

2011-06-24 Thread pacific :-)
Hey all,

I want to know a quick  list of things (positive and negative) looked  in
the code written during interviews.

I think these are a couple of things to take care.

1. Writing compilable code is definitely good.
2. Variables and methods should indicate their need.

Can you guys add more learnt from your experience ?



-- 
regards,
chinna.

-- 
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] SET IN C

2011-06-24 Thread hary rathor
@ pecific : can you explain in more detail?

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



[algogeeks] Re: Queue to support insert , delete, find max in o(1)

2011-06-24 Thread ross
@Piyush:
Dude, that method u suggested wont work ...
It works for stacks because, while deletion of an element, We may
verify if it is in the top of second stack and delete it..
(Since both the data structures are LIFO)
Here in this case, if u delete, you cannot remove the top of stack and
delete an element in the queue...

eg: 1 22 3 44
stack contains(minnm) : 1
if u delete 1, then u pop it from the stack and minm must be 2
I doubt if this problem has a solution.
Correct me if i am wrong.


On Jun 24, 3:33 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 ohh sorry, my bad..I missed that issue...then we can use the same logic
 of using one more stack that we use for implementing modified stack keeping
 track of the min()..I hope this will solve the issue









 On Fri, Jun 24, 2011 at 3:57 PM, ross jagadish1...@gmail.com wrote:
  @piyush,
  Dude, how will that make findmin() to be O(1) because, once the
  minimum element is
  deleted, u would require changes in the others .. Correct me if i am
  wrong..
  Eg:
  consider inserting, 1 5 6 7 9 in order into the circular LL.
  When u make each node keep track of the minm before it, all will
  retain 1 as minm..

  Now consider deleting 1. how will that affect the rest of the list?

  On Jun 24, 3:07 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
   Can we use circular linked list with each new inserted node keeping track
  of
   the minimum before it??

   On Fri, Jun 24, 2011 at 3:20 PM, ross jagadish1...@gmail.com wrote:
Hi,
I know that a stack can be modified with another stack to support push
pop min in const time.
Design a FIFO data structure to support ins, del, and find min in
O(1). Extra space allowed.

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

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

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

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

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



Re: [algogeeks] Google Interview

2011-06-24 Thread Akshata Sharma
@Anantha
can you explain the logic please?
On Fri, Jun 24, 2011 at 10:21 PM, Anantha Krishnan 
ananthakrishnan@gmail.com wrote:

 Check this http://ideone.com/C8fQC

 http://ideone.com/C8fQCThanks  Regards,
 Anantha Krishnan


 On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.com wrote:

 Can anybody please explain how to solve this question with logarithmic
 time complexity ?

 Write the code/algorithm to find the k-th Smallest Element in the
 Union of Two Sorted Arrays .

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


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


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



[algogeeks] NEED ALGO IN TIME 0.00

2011-06-24 Thread prathimzn
http://www.spoj.pl/problems/FASHION/

i summit this question and my time is 0.02 as i used sorting and then
multiply corresponding index value and sum them to get ans.

but best time is 0.00 and 1.6M in C.
can anyone tell me what is the best algo to solve this problem in 0.00 i.e.
best algo

*

- - - - -
WITH REGARDS,
PRAMENDRA RATHI
*
**
*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT 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] Re: Google Question

2011-06-24 Thread Anand
http://anandtechblog.blogspot.com/2011/06/bitonic-merge.html

On Fri, Jun 24, 2011 at 2:17 AM, sankalp srivastava 
richi.sankalp1...@gmail.com wrote:

 1,2,43,41,5 , 6
 Start at a[3] and a[5] Swap them up .
 Reversing it , we get
 1,2,43,5,6,41
 This does not work
  .
 On Jun 23, 9:05 pm, Swathi chukka.swa...@gmail.com wrote:
  We just need to find the start and end of the decreasing sequence then we
  have to reverse the elements in that decreasing sequence by swapping the
  elements at both the edges...
 
  On Thu, Jun 23, 2011 at 2:13 PM, sankalp srivastava 
 
 
 
  richi.sankalp1...@gmail.com wrote:
   @piyush Sinha
 
   How can you do it in O(1) space and O(n) time dude .The inplace
   merging of d sorted arrays take space O(log d) space at least i
   think .Plus even at every step , we have to do O(log n) comparisions
   to find the next larger or smaller element .How can this be O(n) ???
 
   WAiting eagerly for a reply
   On Jun 22, 3:24 pm, Dumanshu duman...@gmail.com wrote:
@Piyush: could u plz post the link to the same?
 
On Jun 22, 2:15 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 
 This question has been discussed over here once...It was concluded
 that this can be solved in O(n) if we know there is a fixed range
 up
 to which the elements keep on increasing and decreasing..for
 example
 in an array of 12 elements, we know 3 elements keep on increasing
 monotonically, then 3 elements keep on decreasing monotonically and
 so
 on
 
 On 6/22/11, chirag ahuja sparkle.chi...@gmail.com wrote:
 
  Given an array of size n wherein elements keep on increasing
  monotonically upto a certain location after which they keep on
  decreasing monotonically, then again keep on increasing, then
  decreasing again and so on. Sort the array in O(n) and O(1).
 
  I didn't understand the question, any array of n elements will be
   like
  this except when first there is a decrese from index 0 to a
 higher
  index. Any ideas about how to solve it in given constraints??
 
  --
  You received this message because you are subscribed to the
 Google
   Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *
 https://www.facebook.com/profile.php?id=10655377926*-Hidequoted
   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.- 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.



-- 
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: Algorithmic Pioneers

2011-06-24 Thread rajeev bharshetty
Thanks Dave for the suggestions I have Updated it.

On Fri, Jun 24, 2011 at 10:13 PM, Dave dave_and_da...@juno.com wrote:

 Add John von Neumann, for Gaussian Elimination.
 Cooley and Tukey for the Fast Fourier Transform.
 Jim Wilkinson, for error analysis in floating point arithmetic.

 Dave

 On Jun 24, 12:44 am, rShetty rajeevr...@gmail.com wrote:
  Collection of Algorithmic Pioneers can be Found here
 
  http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-an...
 
  Suggestion for addition of more Pioneers are welcome .

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



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



[algogeeks] Re: Sum to K problem

2011-06-24 Thread ross
This is the subset sum problem which is NP,.

The DP is as follows,

M[i,j] = 1 , if a subset of first i elements has a sum = j.
else 0,
The recurrence is,
M[i,j] = max(M[i-1,j] , M[i-1,j-Ai]) where Ai is the ith element.

You can maintain back pointers to keep track of previous elements so
that
the solution can be reconstructed from the DP.

Once this matrix is populated till sum=k, Then, the column
corresponding to sum=k, gives
the answer. complexity o(nk).



On Jun 20, 6:38 pm, Harshal hc4...@gmail.com wrote:
 The problem is NP. Complexity using DP will be O(nk), where n is number of
 elements and k is required sum.

 S[0]=true; //choose no element
 S[1...k] = false;
 for each number i in your input
  for s = k downto i
         if ( S[s - i] == true )
             S[s] = true;

 S[s] = true indicates a sum of i can be obtained from a subset of the set.
 To get the elements, we can make S[s] contain the list of numbers that
 contain the sum.
 On Mon, Jun 20, 2011 at 6:53 PM, Navneet Gupta navneetn...@gmail.comwrote:









  Ideally, yes it can. Though i would be happy even if someone gives a
  good answer for non-negative values.

  On Mon, Jun 20, 2011 at 6:28 PM, Akshata Sharma
  akshatasharm...@gmail.com wrote:
   @Navneet: does the set contains negative elements also?

   On Mon, Jun 20, 2011 at 12:26 PM, pacific :-) pacific4...@gmail.com
  wrote:

   @vaibhav : Please note that more than two numbers can sum upto k.

   On Mon, Jun 20, 2011 at 12:21 PM, vaibhav shukla 
  vaibhav200...@gmail.com
   wrote:

   sort the array using merge sort : order nlogn
   take the first element,subtract it with 'k' , then search the result
   using binary search in rest of the array : order nlogn
   hence u get two elements which sum up to K in order nlogn

   On Mon, Jun 20, 2011 at 12:14 PM, Navneet Gupta navneetn...@gmail.com

   wrote:

   Right, in the worst case, complexity with be O(2^N).
   So what are the possible optimizations here? Would building
  pre-computed
   data structures with intermediate sum values help in finding such
  pairs in
   less complexity? I think then we can apply dynamic programming to find
  such
   pairs.

   On Mon, Jun 20, 2011 at 12:09 PM, oppilas . 
  jatka.oppimi...@gmail.com
   wrote:

   I think its a NP problem. The solution complexity can go up O(2^N) in
   worst case.

   On Mon, Jun 20, 2011 at 11:55 AM, Navneet Gupta 
  navneetn...@gmail.com
   wrote:

   Given a set of integers , find a set of numbers such that they sum
  to
   a given number k .
   Notice the set of numbers can have 2 or more than 2 numbers.

   --Navneet

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

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

   --
   --Navneet

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

   --
     best wishes!!
   Vaibhav Shukla
       DU-MCA

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

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

  --
  --Navneet

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

Re: [algogeeks] Writing good code in interviews

2011-06-24 Thread rajeev bharshetty
1 : The Code should be properly indented and readable .
2 : The Code should not exceed the provided by barriers and limits.
3 : It should use better and efficient language constructs.

On Fri, Jun 24, 2011 at 10:54 PM, pacific :-) pacific4...@gmail.com wrote:

 Hey all,

 I want to know a quick  list of things (positive and negative) looked  in
 the code written during interviews.

 I think these are a couple of things to take care.

 1. Writing compilable code is definitely good.
 2. Variables and methods should indicate their need.

 Can you guys add more learnt from your experience ?



 --
 regards,
 chinna.

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


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



Re: [algogeeks] NEED ALGO IN TIME 0.00

2011-06-24 Thread sunny agrawal
i am not sure about this
but when i solved this problem using simple scanf, printf and sort function
of algorithm library, my time was 0.08 so might be reading the values in
character buffer and then parsing then in ints may help

how did you implemented ?
did you implemented your own sort funtion ?
which input/output methods you used ?


On Fri, Jun 24, 2011 at 11:23 PM, prathimzn prathi...@gmail.com wrote:


 http://www.spoj.pl/problems/FASHION/

 i summit this question and my time is 0.02 as i used sorting and then
 multiply corresponding index value and sum them to get ans.

 but best time is 0.00 and 1.6M in C.
 can anyone tell me what is the best algo to solve this problem in 0.00 i.e.
 best algo

 *

 - - - - -
 WITH REGARDS,
 PRAMENDRA RATHI
 *
 **
 *B.TECH 2ND YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT 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.




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



Re: [algogeeks] NEED ALGO IN TIME 0.00

2011-06-24 Thread prathimzn
sorry my time is 0.2 and i use simple int array and sort function of
algorithm...
*- - - - -
WITH REGARDS,

*
*
PRAMENDRA RATHI
*
**

*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*



On Sat, Jun 25, 2011 at 12:04 AM, sunny agrawal sunny816.i...@gmail.comwrote:

 i am not sure about this
 but when i solved this problem using simple scanf, printf and sort function
 of algorithm library, my time was 0.08 so might be reading the values in
 character buffer and then parsing then in ints may help

 how did you implemented ?
 did you implemented your own sort funtion ?
 which input/output methods you used ?


 On Fri, Jun 24, 2011 at 11:23 PM, prathimzn prathi...@gmail.com wrote:


 http://www.spoj.pl/problems/FASHION/

 i summit this question and my time is 0.02 as i used sorting and then
 multiply corresponding index value and sum them to get ans.

 but best time is 0.00 and 1.6M in C.
 can anyone tell me what is the best algo to solve this problem in 0.00
 i.e. best algo

 *

 - - - - -
 WITH REGARDS,
 PRAMENDRA RATHI
 *
 **
 *B.TECH 2ND YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT 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.




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



[algogeeks] نجدية تتناك على الارض وهى لابسة نظارة شمس

2011-06-24 Thread asxsa asxsa
http://2.bp.blogspot.com/-w-ysqn9SFWw/TgTfg1qnf5I/Ac0/Jr9AmaCiXTc/s1600/thumbs20110624203258.jpg



[image: http://i20.servimg.com/u/f20/09/00/39/91/010.png]



[image: http://i20.servimg.com/u/f20/09/00/39/91/010.gif]



[image: http://i20.servimg.com/u/f20/09/00/39/91/0010.png]


* Name*

*
نجدية تتناك على الارض وهى لابسة نظارة شمس*


* Size*


*5**.48 Mb*

*
** Duration*


* 04:**24*


[image: http://i20.servimg.com/u/f20/09/00/39/91/gmrup110.gif]



[image: http://i20.servimg.com/u/f20/09/00/39/91/010.gif]



 [image: شرح التحميل من الموقع بت شير اضغط
هنا]http://i20.servimg.com/u/f20/09/00/39/91/oouu_o10.jpg



* http://bitshare.com/files/kt2pqxkg/www.asxsa.net.2.wmv.html.html*



[image: http://i20.servimg.com/u/f20/09/00/39/91/010.gif]



 [image: شرح التحميل من الموقع هوت فايل اضغط
هنا]http://i20.servimg.com/u/f20/09/00/39/91/oouu_o11.jpg



* http://hotfile.com/dl/122042352/bc084db/www.asxsa.net.2.wmv.html*



[image: http://i20.servimg.com/u/f20/09/00/39/91/010.gif]



[image: http://i20.servimg.com/u/f20/09/00/39/91/frasha10.gif]



* التعارف للبنات فقط لا غير بليز

** zerr1...@gmail.com

للاشتراك معي في قروبي ارسل رسالة فارغة على الايميلــ

 sextop2012+subscr...@googlegroups.com**

رجاجيل ن * [image: http://i20.servimg.com/u/f20/09/00/39/91/o2110.gif]*

نساوين يس * [image:
http://i20.servimg.com/u/f20/09/00/39/91/love10.gif]*

***

*شرح التحميل من المواقع اضغط على صورة الموقع*



 [image: شرح التحميل من الموقع بت شير اضغط
هنا]http://i20.servimg.com/u/f20/09/00/39/91/oouu_o10.jpg



 [image: شرح التحميل من الموقع هوت فايل اضغط
هنا]http://i20.servimg.com/u/f20/09/00/39/91/oouu_o11.jpg

-- 
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] Sort - Consecutive Array in O(n)

2011-06-24 Thread ross
Given an array, A, find if all elements in the sorted version of A are
consecutive in less than O(nlogn).
eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive --
true
A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive -
false

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



[algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread ross
One solution would be to : check if max-min = N and
that all elements are unique in the array.
However, this may require space complexity.. Looking for a
better solution.

On Jun 25, 12:44 am, ross jagadish1...@gmail.com wrote:
 Given an array, A, find if all elements in the sorted version of A are
 consecutive in less than O(nlogn).
 eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive --
 true
 A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive -
 false

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

2011-06-24 Thread ankit sambyal
start thinking as we do in a binary search.
if we want to find the kth smallest no., then compare the k/2 elements
of both the arrays. And depending upon the answer, go for further
iterations
Try it out..Plz ask if u don't understand. I hv just droped a small hint


Ankit Sambyal
BITS Pilani




On Fri, Jun 24, 2011 at 10:50 AM, Akshata Sharma
akshatasharm...@gmail.com wrote:
 @Anantha
 can you explain the logic please?
 On Fri, Jun 24, 2011 at 10:21 PM, Anantha Krishnan
 ananthakrishnan@gmail.com wrote:

 Check this http://ideone.com/C8fQC
 Thanks  Regards,
 Anantha Krishnan

 On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.com wrote:

 Can anybody please explain how to solve this question with logarithmic
 time complexity ?

 Write the code/algorithm to find the k-th Smallest Element in the
 Union of Two Sorted Arrays .

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


-- 
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: Sort - Consecutive Array in O(n)

2011-06-24 Thread Piyush Sinha
I have a solution that will do the job in O(n) time but will require three
variablesbut this solution won't work if the array contains -ve numbers.
*
int findrepeat(int a[],int n)
{
 int i,xor = 0;
 int min = findmin(a,n);
 int max = findmax(a,n);
 if((max-min+1)!=n)
 return 0;
 for(i = 0 ;in;i++)
  xor^=a[i];
 for(i=min;i=max;i++)
 xor^=i;
 if(xor)
 return 0;
 else
  return 1;
}*

Please let me know if there is any counter example..


On Sat, Jun 25, 2011 at 1:17 AM, ross jagadish1...@gmail.com wrote:

 One solution would be to : check if max-min = N and
 that all elements are unique in the array.
 However, this may require space complexity.. Looking for a
 better solution.

 On Jun 25, 12:44 am, ross jagadish1...@gmail.com wrote:
  Given an array, A, find if all elements in the sorted version of A are
  consecutive in less than O(nlogn).
  eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive --
  true
  A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive -
  false

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




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

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



[algogeeks] QA Tester With Microstrategy || Very Very Very Hot Requirement of the day------

2011-06-24 Thread Steven Smith
Blank
Hi Business Partner,
Hope you are doing well today,

This is Steven Smith from Panzer Solutions looking for QA Tester With
Microstrategy  for* 2+Month contract*. Please let me know if you have any
one available for below position.

Position : QA Tester With Microstrategy
Located : Reston, VA.
Duration :2+ Month Contract
Visa :  US Citizen, Green Card,EAD


*/ Very Very Hot Requirement //*

*Required :*
QA Testers that have Microstrategy reporting skills with excellent knowledge
in SQL

**
Warm Regards,
Steven Smith | Technical Recruiter

Panzer Solutions LLC

Email :  steven.sm...@panzersolutions.com
Direct: 203 813 0903

-- 
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] O(n) Time is the problem. ..

2011-06-24 Thread aditya kumar
soln 1 : we can take one more array B[ ] of size n. start inserting the
number from the array A[ ] into the index of array B[ ] ie number 39 from
array   A[ ] will go in 39th place . finally the missing element can be
found by tracing array B[ ] .

soln 2 :Find sum of n numbers and Sum of all the numbers in the array,
difference in both is the number which is missing.

hope i got the question right ??
correct me if i am wrong .
On Fri, Jun 24, 2011 at 7:14 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 hmm i also doubt that
 but it is Strictly O(32n) not O(nlgn) where lgn = 32 depending upon value
 of n



 On Fri, Jun 24, 2011 at 1:10 PM, rizwan hudda rizwanhu...@gmail.comwrote:

 @sunny: Think again, your solution will take O(n*log(n)), where log(n) is
 the number of bits to represent
 the number.


 On Thu, Jun 23, 2011 at 6:51 PM, Sriganesh Krishnan 2448...@gmail.comwrote:

 can you explain mewhat the logic is...behind the xor operation?...is
 it like inversion or encryption?


 On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal sunny816.i...@gmail.com
  wrote:

 initially compute xor of all the values from 0 to n in a variable Temp
 so temp = 0^1^2^n
 let result is used to store the missing number
 for each ith bit of missing number where i = 0-31 we can find it as
 following
 ith bit of result = (xor of all ith bits of values of array) xored with
 (ith
 bit of temp)

 On Thu, Jun 23, 2011 at 12:25 AM, oppilas . 
 jatka.oppimi...@gmail.comwrote:

 Is the array sorted?
 In A[1..n], one number is missing from 0 to N. So,
 A[5]={--INF, 2,1,3,0} is a valid case?


 On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.comwrote:

 An array A[1...n] contains all the integers from 0 to n except for one
 number which is
 missing. In this problem, we cannot access an entire integer in A with
 a single opera-
 tion. The elements of A are represented in binary, and the only
 operation we can use
 to access them is “fetch the jth bit of A[i]”, which takes constant
 time. Write code to
   find the missing integer. Can you do it in O(n) time?
  _
  _ _

 Rajeev N Bharshetty
 I Blog @ www.opensourcemania.co.cc

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




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




 --
 Thanks and regards
 Rizwan A Hudda
 http://sites.google.com/site/rizwanhudda



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




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



Re: [algogeeks] Google Interview

2011-06-24 Thread Anand
Two arrays are arr[] and sec[]
To find kth smallest element of the two sorted array. i = 1

   1. Find Index = k/(2 ^ i)
   2. if arr[Index]  sec[Index]  arr[index]  sec[index -1] then
   increment index of the first array and decrement the index of second array.
   i++
   3. if arr[index]  sec[Index]  arr[index]  sec[index-1] then decrement
   index of the first array and increment the index of second array i++
   4. Step to increment or decrement = K/pow(2,i)

Please see the code for more clarity. Let me know if I am missing any corner
cases.
http://codepad.org/liCpqyqC

On Fri, Jun 24, 2011 at 12:55 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 start thinking as we do in a binary search.
 if we want to find the kth smallest no., then compare the k/2 elements
 of both the arrays. And depending upon the answer, go for further
 iterations
 Try it out..Plz ask if u don't understand. I hv just droped a small
 hint


 Ankit Sambyal
 BITS Pilani




 On Fri, Jun 24, 2011 at 10:50 AM, Akshata Sharma
 akshatasharm...@gmail.com wrote:
  @Anantha
  can you explain the logic please?
  On Fri, Jun 24, 2011 at 10:21 PM, Anantha Krishnan
  ananthakrishnan@gmail.com wrote:
 
  Check this http://ideone.com/C8fQC
  Thanks  Regards,
  Anantha Krishnan
 
  On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.com
 wrote:
 
  Can anybody please explain how to solve this question with logarithmic
  time complexity ?
 
  Write the code/algorithm to find the k-th Smallest Element in the
  Union of Two Sorted Arrays .
 
  --
  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.
 

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



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



[algogeeks] Re: O(n) Time is the problem. ..

2011-06-24 Thread Dave
@Sunny: What makes you think that the integers are 32 bits in length.
Remember that O(.) notation applies as n -- infinity. Thus, O(n log
n) is correct for a naive algorithm. But a little thought can give a
divide-and-conquer algorithm which is O(n).

Dave

On Jun 24, 8:44 am, sunny agrawal sunny816.i...@gmail.com wrote:
 hmm i also doubt that
 but it is Strictly O(32n) not O(nlgn) where lgn = 32 depending upon value
 of n





 On Fri, Jun 24, 2011 at 1:10 PM, rizwan hudda rizwanhu...@gmail.com wrote:
  @sunny: Think again, your solution will take O(n*log(n)), where log(n) is
  the number of bits to represent
  the number.

  On Thu, Jun 23, 2011 at 6:51 PM, Sriganesh Krishnan 
  2448...@gmail.comwrote:

  can you explain mewhat the logic is...behind the xor operation?...is
  it like inversion or encryption?

  On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal 
  sunny816.i...@gmail.comwrote:

  initially compute xor of all the values from 0 to n in a variable Temp
  so temp = 0^1^2^n
  let result is used to store the missing number
  for each ith bit of missing number where i = 0-31 we can find it as
  following
  ith bit of result = (xor of all ith bits of values of array) xored with
  (ith
  bit of temp)

  On Thu, Jun 23, 2011 at 12:25 AM, oppilas . 
  jatka.oppimi...@gmail.comwrote:

  Is the array sorted?
  In A[1..n], one number is missing from 0 to N. So,
  A[5]={--INF, 2,1,3,0} is a valid case?

  On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.comwrote:

  An array A[1...n] contains all the integers from 0 to n except for one
  number which is
  missing. In this problem, we cannot access an entire integer in A with
  a single opera-
  tion. The elements of A are represented in binary, and the only
  operation we can use
  to access them is “fetch the jth bit of A[i]”, which takes constant
  time. Write code to
    find the missing integer. Can you do it in O(n) time?
   _
   _ _

  Rajeev N Bharshetty
  I Blog @www.opensourcemania.co.cc

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

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

  --
  Thanks and regards
  Rizwan A Hudda
 http://sites.google.com/site/rizwanhudda

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

 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee- 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.



[algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread Gene
Nice idea, but unfortunately doesn't work. The XOR only contains
parity information. So just pick two values in the range and a low
order bit where they're different.  Then swap the bits.

2 xor 3 xor 4 xor 5 = 0

Pick 3 and 4 and swap the lsb, which gives 2 and 5.  So we have

2 xor 2 xor 5 xor 5 = 0


On Jun 24, 4:12 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 I have a solution that will do the job in O(n) time but will require three
 variablesbut this solution won't work if the array contains -ve numbers.
 *
 int findrepeat(int a[],int n)
 {
      int i,xor = 0;
      int min = findmin(a,n);
      int max = findmax(a,n);
      if((max-min+1)!=n)
          return 0;
      for(i = 0 ;in;i++)
           xor^=a[i];
      for(i=min;i=max;i++)
          xor^=i;
      if(xor)
              return 0;
      else
           return 1;

 }*

 Please let me know if there is any counter example..





 On Sat, Jun 25, 2011 at 1:17 AM, ross jagadish1...@gmail.com wrote:
  One solution would be to : check if max-min = N and
  that all elements are unique in the array.
  However, this may require space complexity.. Looking for a
  better solution.

  On Jun 25, 12:44 am, ross jagadish1...@gmail.com wrote:
   Given an array, A, find if all elements in the sorted version of A are
   consecutive in less than O(nlogn).
   eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive --
   true
   A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive -
   false

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

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

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



Re: [algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread oppilas .
Gene is correct :)
Counter example
{1, 2, 2, 5, 5}
See method 3 here http://geeksforgeeks.org/?p=11516


On 6/25/11, Gene gene.ress...@gmail.com wrote:
 Nice idea, but unfortunately doesn't work. The XOR only contains
 parity information. So just pick two values in the range and a low
 order bit where they're different.  Then swap the bits.

 2 xor 3 xor 4 xor 5 = 0

 Pick 3 and 4 and swap the lsb, which gives 2 and 5.  So we have

 2 xor 2 xor 5 xor 5 = 0


 On Jun 24, 4:12 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 I have a solution that will do the job in O(n) time but will require three
 variablesbut this solution won't work if the array contains -ve
 numbers.
 *
 int findrepeat(int a[],int n)
 {
      int i,xor = 0;
      int min = findmin(a,n);
      int max = findmax(a,n);
      if((max-min+1)!=n)
          return 0;
      for(i = 0 ;in;i++)
           xor^=a[i];
      for(i=min;i=max;i++)
          xor^=i;
      if(xor)
              return 0;
      else
           return 1;

 }*

 Please let me know if there is any counter example..





 On Sat, Jun 25, 2011 at 1:17 AM, ross jagadish1...@gmail.com wrote:
  One solution would be to : check if max-min = N and
  that all elements are unique in the array.
  However, this may require space complexity.. Looking for a
  better solution.

  On Jun 25, 12:44 am, ross jagadish1...@gmail.com wrote:
   Given an array, A, find if all elements in the sorted version of A are
   consecutive in less than O(nlogn).
   eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive --
   true
   A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive -
   false

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

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

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



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



Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-24 Thread sunny agrawal
@Dave it is given in Question that elements of array are integer

On Sat, Jun 25, 2011 at 7:17 AM, Dave dave_and_da...@juno.com wrote:

 @Sunny: What makes you think that the integers are 32 bits in length.
 Remember that O(.) notation applies as n -- infinity. Thus, O(n log
 n) is correct for a naive algorithm. But a little thought can give a
 divide-and-conquer algorithm which is O(n).

 Dave

 On Jun 24, 8:44 am, sunny agrawal sunny816.i...@gmail.com wrote:
  hmm i also doubt that
  but it is Strictly O(32n) not O(nlgn) where lgn = 32 depending upon
 value
  of n
 
 
 
 
 
  On Fri, Jun 24, 2011 at 1:10 PM, rizwan hudda rizwanhu...@gmail.com
 wrote:
   @sunny: Think again, your solution will take O(n*log(n)), where log(n)
 is
   the number of bits to represent
   the number.
 
   On Thu, Jun 23, 2011 at 6:51 PM, Sriganesh Krishnan 2448...@gmail.com
 wrote:
 
   can you explain mewhat the logic is...behind the xor
 operation?...is
   it like inversion or encryption?
 
   On Thu, Jun 23, 2011 at 11:59 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:
 
   initially compute xor of all the values from 0 to n in a variable
 Temp
   so temp = 0^1^2^n
   let result is used to store the missing number
   for each ith bit of missing number where i = 0-31 we can find it as
   following
   ith bit of result = (xor of all ith bits of values of array) xored
 with
   (ith
   bit of temp)
 
   On Thu, Jun 23, 2011 at 12:25 AM, oppilas . 
 jatka.oppimi...@gmail.comwrote:
 
   Is the array sorted?
   In A[1..n], one number is missing from 0 to N. So,
   A[5]={--INF, 2,1,3,0} is a valid case?
 
   On Wed, Jun 22, 2011 at 11:51 PM, RollBack rajeevr...@gmail.com
 wrote:
 
   An array A[1...n] contains all the integers from 0 to n except for
 one
   number which is
   missing. In this problem, we cannot access an entire integer in A
 with
   a single opera-
   tion. The elements of A are represented in binary, and the only
   operation we can use
   to access them is “fetch the jth bit of A[i]”, which takes constant
   time. Write code to
 find the missing integer. Can you do it in O(n) time?
_
_ _
 
   Rajeev N Bharshetty
   I Blog @www.opensourcemania.co.cc
 
   --
   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.
 
   --
   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.
 
   --
   Thanks and regards
   Rizwan A Hudda
  http://sites.google.com/site/rizwanhudda
 
--
   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.
 
  --
  Sunny Aggrawal
  B-Tech IV year,CSI
  Indian Institute Of Technology,Roorkee- 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.




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

Re: [algogeeks] Re: Google Question

2011-06-24 Thread ankit sambyal
@Anand : Plz explain ur algo ???




On Fri, Jun 24, 2011 at 10:55 AM, Anand anandut2...@gmail.com wrote:
 http://anandtechblog.blogspot.com/2011/06/bitonic-merge.html

 On Fri, Jun 24, 2011 at 2:17 AM, sankalp srivastava
 richi.sankalp1...@gmail.com wrote:

 1,2,43,41,5 , 6
 Start at a[3] and a[5] Swap them up .
 Reversing it , we get
 1,2,43,5,6,41
 This does not work
  .
 On Jun 23, 9:05 pm, Swathi chukka.swa...@gmail.com wrote:
  We just need to find the start and end of the decreasing sequence then
  we
  have to reverse the elements in that decreasing sequence by swapping the
  elements at both the edges...
 
  On Thu, Jun 23, 2011 at 2:13 PM, sankalp srivastava 
 
 
 
  richi.sankalp1...@gmail.com wrote:
   @piyush Sinha
 
   How can you do it in O(1) space and O(n) time dude .The inplace
   merging of d sorted arrays take space O(log d) space at least i
   think .Plus even at every step , we have to do O(log n) comparisions
   to find the next larger or smaller element .How can this be O(n) ???
 
   WAiting eagerly for a reply
   On Jun 22, 3:24 pm, Dumanshu duman...@gmail.com wrote:
@Piyush: could u plz post the link to the same?
 
On Jun 22, 2:15 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 
 This question has been discussed over here once...It was concluded
 that this can be solved in O(n) if we know there is a fixed range
 up
 to which the elements keep on increasing and decreasing..for
 example
 in an array of 12 elements, we know 3 elements keep on increasing
 monotonically, then 3 elements keep on decreasing monotonically
 and so
 on
 
 On 6/22/11, chirag ahuja sparkle.chi...@gmail.com wrote:
 
  Given an array of size n wherein elements keep on increasing
  monotonically upto a certain location after which they keep on
  decreasing monotonically, then again keep on increasing, then
  decreasing again and so on. Sort the array in O(n) and O(1).
 
  I didn't understand the question, any array of n elements will
  be
   like
  this except when first there is a decrese from index 0 to a
  higher
  index. Any ideas about how to solve it in given constraints??
 
  --
  You received this message because you are subscribed to the
  Google
   Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*

 *https://www.facebook.com/profile.php?id=10655377926*-Hidequoted
   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.- 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.


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


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



[algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread Adarsh
int n = A.size();
for (int i=0; in; i++)
total += A[i];
findMinMax(A[1...n]);

int mean = (max+min)/2;
if ((total - n*mean) == 0)
printf(consecutive\n);
else
printf(not consecutive\n);


findMixMax() ... this can be done in O(n)
so, total time complexity ... O(n)

works for negative numbers also if there is any mistake ... let me
know

-- 
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: Sort - Consecutive Array in O(n)

2011-06-24 Thread sunny agrawal
@Adarsh
fails on this
a[] = {2,2,2,6,6,6}

On Sat, Jun 25, 2011 at 10:54 AM, Adarsh s.adars...@gmail.com wrote:

 int n = A.size();
 for (int i=0; in; i++)
total += A[i];
 findMinMax(A[1...n]);

 int mean = (max+min)/2;
 if ((total - n*mean) == 0)
printf(consecutive\n);
 else
printf(not consecutive\n);


 findMixMax() ... this can be done in O(n)
 so, total time complexity ... O(n)

 works for negative numbers also if there is any mistake ... let me
 know

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




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



Re: [algogeeks] Google Interview

2011-06-24 Thread Anantha Krishnan
Idea is like this since both the arrays may not be of same length lets
divide (k-1) smallest elements proportionally in both the arrays:

let i point the array A by
i=m/(m+n) * (k-1) [since we have to divide k-1 elements among two]
j=(k-1) - i

then try to insert A[i] between B[j-1] and B[j] if three are not in asc
order try to insert B[j] between A[i-1] and A[i]
If any one of the above satisfies we found kth smallest element else,

check which one is smallest among A[i] and B[j] its logical that if A[i] is
smallest then we can A[0] to A[i] for the next iteration and
k becomes k-i-1 also m becomes m-i-1 i.e now we have only m-i-1+n elements
out of which we have to find k-i-1th smallest thus the iteration goes
on until we
find our kth smallest element.

Consider 2 arrays

A={5,7,9,20}; length of A: m=4
B={10,12,21,27,35,50}; length of B: n=6

let K be 4

i=4/10*3=1;  A[1]=7;
j=3-1=2;  B[2]=21;

B[1]=12 A[1]=7  B[2]=21 [not in asc order]
A[0]=5  B[2]=21 A[1]=7   [not in asc order]

so now,
k=k-i-1  =4-1-1=2
m=m-i-1=4-1-1=2
n=6

A={9,20}; length of A: m=2
B={10,12,21,27,35,50}; length of B: n=6

i=2/8*1=0;  A[0]=9;
j=1-0=1; B[1]=12;

(acutally A[-1] is just for understanding)
B[0]=10  A[0]=9  B[1]=12 [not in asc order]
A[-1]=-INF  B[1]=12 A[0]=9   [not in asc order]

now,
k=k-i-1=2-0-1=1;
m=m-i-1=2-0-1=1;
n=6;
A={20}; length of A: m=1
B={10,12,21,27,35,50}; length of B: n=6

i=1/7*0=0;  A[0]=20;
j=0-0=0; B[0]=10;

(acutally A[-1] and B[-1] are just for understanding)
B[-1]=-INF  A[0]=20  B[0]=10 [not in asc order]
A[-1]=-INF  B[0]=10 A[0]=20  [in asc order]

We got the Kth(4th) smallest element which is 10.

Thanks  Regards,
Anantha Krishnan


On Fri, Jun 24, 2011 at 11:20 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 @Anantha
 can you explain the logic please?
 On Fri, Jun 24, 2011 at 10:21 PM, Anantha Krishnan 
 ananthakrishnan@gmail.com wrote:

 Check this http://ideone.com/C8fQC

 http://ideone.com/C8fQCThanks  Regards,
 Anantha Krishnan


 On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.comwrote:

 Can anybody please explain how to solve this question with logarithmic
 time complexity ?

 Write the code/algorithm to find the k-th Smallest Element in the
 Union of Two Sorted Arrays .

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


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



[algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread Adarsh
Missed that... also, my method seems to work only if number of
elements are odd.

-- 
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: Sort - Consecutive Array in O(n)

2011-06-24 Thread sunny agrawal
@adarsh
no it will Fails for both even and odd no of elemets
a[] = {2,2,2,4,6,6,6}

seems like we need to check for the presence of each no between min to max
using a good hashing approach.

On Sat, Jun 25, 2011 at 11:20 AM, Adarsh s.adars...@gmail.com wrote:

 Missed that... also, my method seems to work only if number of
 elements are odd.

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




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



[algogeeks] Re: spoj shlights

2011-06-24 Thread anonymous procrastination
Hello,

Were you able to figure out the solution?

On Jun 23, 3:33 pm, Jitendra singh jsinghrath...@gmail.com wrote:
 @ kartik sachan
 Problem with this code is this-
 All GB pairs should be process in one time period

 On 6/23/11, kartik sachan kartik.sac...@gmail.com wrote:



  QUESTION LINK IShttp://www.spoj.pl/problems/SHLIGHTS/

  MY CODE IS GIVEN BELOW
  ITS IS GIVING TLEPLZZ HELP ME OUT

  # includecstdio
  # includecstring
  int main()
  {

  int t;
  char a[17];
  scanf(%d,t);
  int i,j,k;

  while(t--)
      {
          int count=0;
          int flag=0,flag1=0;

          scanf(%s,a);
          while(1)
          {

              for(i=0;a[i]!='\0';i++)
                      if(a[i]=='G'a[i+1]=='B')
                          {a[i]='B';a[i+1]='G';i=i+1;flag1=1;}
              if(flag1==1)
              {count++;flag1=0;}
              if(count =flag)
              break;
              flag=count;
          }
      printf(%d\n,count);
      }
  return 0;
  }

  PLZZ HELP ME OUT OR SUGGEST ANY OTHER LOGIC IF IT  HAS SOME MISTAKES

  --

  *WITH REGARDS,*
  *
  *
  *KARTIK SACHAN*

  *B.TECH 2ND YEAR*
  *COMPUTER SCIENCE AND ENGINEERING*
  *NIT 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.- 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.