Re: [algogeeks] Re: char *arr and char arr[]

2011-06-27 Thread sagar pareek
@oppilas
char *ptr=hello
in this case the string becomes constant but not the ptr, you can do this.
char *ptr=hello;
char arr[]=hi;
ptr[0]=B; //not work
ptr=arr; //work
arr[0]=H; //work
ptr[0]=N; //work

Only string Hello becomes constant, it cant be changed.

Read - const char *ptr , char const *ptr, char * const ptr for more details.

I think you now got it.

On Sat, Jun 25, 2011 at 4:59 PM, oppilas . jatka.oppimi...@gmail.comwrote:

 Thanks all :).


 On 6/25/11, Anantha Krishnan ananthakrishnan@gmail.com wrote:
  When we declare *char *str=hello;*
 
  this hello will be stored in the read-only memory i.e *TEXT Segment*.
 
  so when we try to write the read-only memory by **str='w';* it will
  throw *Segmentation
  fault*.
 
  Obviously we must allocate some memory in heap to modify it like:
  *char *str=(char *)malloc(1024);*
 
  Thanks  Regards,
  Anantha Krishnan
 
  On Sat, Jun 25, 2011 at 2:16 PM, Adarsh s.adars...@gmail.com wrote:
 
  char array[] = hello;
  char *pointer = hello;
 
  array is an array, enough to store sequence of characters and '\0'
  array will always refer to same storage.
  Here, pointer is initialized to point to a string constant, pointer
  may be modified, but you cannot chage string contents
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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




-- 
*Regards
Sagar Pareek
M.Tech cse (pur.)
Motilal Nehru National Institute Of Technology (MN 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.



[algogeeks] Re: OS

2011-06-27 Thread Mihir
@Sanket: You are wrong. Check the loops again!

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/ifxkh_x5o0EJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] image processing

2011-06-27 Thread Arun Vishwanathan
yes it is matching points between 2 different pictures of the same object
taken in different environments..not different views of the same object

On Sun, Jun 26, 2011 at 5:57 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 YES.. we need to have 2 shots.. !!
  u said u had some matching points in the 2 images


 On Sun, Jun 26, 2011 at 6:23 PM, Arun Vishwanathan aaron.nar...@gmail.com
  wrote:

 hmm for starting this , we need 2 shots of a scene right? I have only a
 single image..no stereo vision here


 On Sun, Jun 26, 2011 at 2:16 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 I don't know how far u have been able to conquer the problem .. We tried
 this and used epipolar geometry and 7point algo and found the Homography
 matrix.. try referring to Hartley and Zeisserman book.!!

 On Thu, Jun 23, 2011 at 3:52 PM, DK divyekap...@gmail.com wrote:

 Perspective transformations are non linear because in this case Y = AX
 the matrix A is a function of Y and X.
 It would be linear only if A was independent of X and Y.
 (See the derivation on that link).

 --
 DK

 http://twitter.com/divyekapoor
 http://www.divye.in

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
  Arun Vish
 Graduate Student
 Department of Computer Science
 University of Southern California

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
 Arun Vish
Graduate Student
Department of Computer Science
University of Southern California

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OS

2011-06-27 Thread Nishant Mittal
plz recommend me some good sites for OS interview questions...
Thanx in advance

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Bharath Soma
HI

Do an inorder traversal on that bst n form a sorted array...then u can
search for that 2 elements in O(n)

On Mon, Jun 27, 2011 at 2:01 PM, manish kapur manishkapur.n...@gmail.comwrote:


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Bharath

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Nishant Mittal
do inorder traversal of tree and store values in an array.
Now find pairs by applying binary search on array..

On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] MS question

2011-06-27 Thread Nishant Mittal
WAP to sort an array of character strings on the basis of last
character of each string
eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OS

2011-06-27 Thread Navneet Gupta
One such resource
http://placementsindia.blogspot.com/search/label/Operating%20Systems

On Mon, Jun 27, 2011 at 2:01 PM, Nishant Mittal
mittal.nishan...@gmail.com wrote:
 plz recommend me some good sites for OS interview questions...
 Thanx in advance

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





-- 
--Navneet

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



Re: [algogeeks] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread ankit sambyal
@Bharath : Cud u plz explain how r u searching the elements in O(n) time?
Because if we use binary search, it will have O(n*log n )  worst case
time complexity. One way in which I think it cud be made O(n) is that
we can use a hash table, with a good hash function apart frm the
array. And then for each element 'm' in the array, we cud search if
there is an element (sum - m) in O(1) time by using hash table. Still
we can't assure O(n) time complexity. Because coming up with a good
hash function is not easy. Again, hash table takes more space




On Mon, Jun 27, 2011 at 1:40 AM, Nishant Mittal
mittal.nishan...@gmail.com wrote:
 do inorder traversal of tree and store values in an array.
 Now find pairs by applying binary search on array..

 On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] MS question

2011-06-27 Thread varun pahwa
reverse all strings and then sort.

On Mon, Jun 27, 2011 at 2:28 PM, Nishant Mittal
mittal.nishan...@gmail.comwrote:

 WAP to sort an array of character strings on the basis of last
 character of each string
 eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}

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




-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112 ,08011820777
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Nishant Mittal
(for array sorted in ascending order)
take 2 indexes i and j pointing to 1st and last element of the array
respectively...
now if(arr[i]+arr[j] == x)
print(arr[i]);
print(arr[j];
else if(arr[i]+arr[j]x)
j--;
else
i++;

I think this should work...(i've not checked)
correct me if i m wrong


On 6/27/11, ankit sambyal ankitsamb...@gmail.com wrote:
 @Bharath : Cud u plz explain how r u searching the elements in O(n) time?
 Because if we use binary search, it will have O(n*log n )  worst case
 time complexity. One way in which I think it cud be made O(n) is that
 we can use a hash table, with a good hash function apart frm the
 array. And then for each element 'm' in the array, we cud search if
 there is an element (sum - m) in O(1) time by using hash table. Still
 we can't assure O(n) time complexity. Because coming up with a good
 hash function is not easy. Again, hash table takes more space




 On Mon, Jun 27, 2011 at 1:40 AM, Nishant Mittal
 mittal.nishan...@gmail.com wrote:
 do inorder traversal of tree and store values in an array.
 Now find pairs by applying binary search on array..

 On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread varun pahwa
@ankit: no need to use hash table for that.
simply run two pointers one from 0 and second from n - 1.

On Mon, Jun 27, 2011 at 2:51 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @Bharath : Cud u plz explain how r u searching the elements in O(n) time?
 Because if we use binary search, it will have O(n*log n )  worst case
 time complexity. One way in which I think it cud be made O(n) is that
 we can use a hash table, with a good hash function apart frm the
 array. And then for each element 'm' in the array, we cud search if
 there is an element (sum - m) in O(1) time by using hash table. Still
 we can't assure O(n) time complexity. Because coming up with a good
 hash function is not easy. Again, hash table takes more space




 On Mon, Jun 27, 2011 at 1:40 AM, Nishant Mittal
 mittal.nishan...@gmail.com wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112 ,08011820777
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Piyush Sinha
Instead of using an array...we can do this by converting the BST into a
doubly linked list...but this will definitely modify the BST..


On Mon, Jun 27, 2011 at 3:01 PM, varun pahwa varunpahwa2...@gmail.comwrote:

 @ankit: no need to use hash table for that.
 simply run two pointers one from 0 and second from n - 1.

 On Mon, Jun 27, 2011 at 2:51 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @Bharath : Cud u plz explain how r u searching the elements in O(n) time?
 Because if we use binary search, it will have O(n*log n )  worst case
 time complexity. One way in which I think it cud be made O(n) is that
 we can use a hash table, with a good hash function apart frm the
 array. And then for each element 'm' in the array, we cud search if
 there is an element (sum - m) in O(1) time by using hash table. Still
 we can't assure O(n) time complexity. Because coming up with a good
 hash function is not easy. Again, hash table takes more space




 On Mon, Jun 27, 2011 at 1:40 AM, Nishant Mittal
 mittal.nishan...@gmail.com wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




 --
 Varun Pahwa
 B.Tech (IT)
 7th Sem.
 Indian Institute of Information Technology Allahabad.
 Ph : 09793899112 ,08011820777
 Official Email :: rit2008...@iiita.ac.in
 Another Email :: varunpahwa.ii...@gmail.com

 People who fail to plan are those who plan to fail.

 --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] [brain teaser ] Statement Riddle

2011-06-27 Thread Lavesh Rawat
*Statement Riddle  - 27 june
 *
*
*
**
*'Ferari driver' easily beats the 'force indain driver' in a two care
race.How did Indian newspapers *
*truthfully report so to look as 'force indain drive' had outdone the
'ferari driver'
Think ??
*
*Update Your Answers at* : Click
Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?lavesh=lavesh

*Solution:*
Will be updated after 1 day




-- 

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

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



Re: [algogeeks] [brain teaser ] Statement Riddle

2011-06-27 Thread shady
if moderators are alive, can they ban him ?

On Mon, Jun 27, 2011 at 12:48 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *Statement Riddle  - 27 june
  *
 *
 *
 **
 *'Ferari driver' easily beats the 'force indain driver' in a two care
 race.How did Indian newspapers *
 *truthfully report so to look as 'force indain drive' had outdone the
 'ferari driver'
 Think ??
 *
 *Update Your Answers at* : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?lavesh=lavesh

 *Solution:*
 Will be updated after 1 day




 --

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

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


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 ] Statement Riddle

2011-06-27 Thread Shachindra A C
+1 to shady's post. Please ban him.

On Mon, Jun 27, 2011 at 5:32 PM, shady sinv...@gmail.com wrote:

 if moderators are alive, can they ban him ?


 On Mon, Jun 27, 2011 at 12:48 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *Statement Riddle  - 27 june
  *
 *
 *
 **
 *'Ferari driver' easily beats the 'force indain driver' in a two care
 race.How did Indian newspapers *
 *truthfully report so to look as 'force indain drive' had outdone the
 'ferari driver'
 Think ??
 *
 *Update Your Answers at* : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?lavesh=lavesh

 *Solution:*
 Will be updated after 1 day




 --

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

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


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
Shachindra A C

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 ] Statement Riddle

2011-06-27 Thread sharad kumar
i have added anton nomiste as the new moderator...

On Mon, Jun 27, 2011 at 5:36 PM, sharad kumar aryansmit3...@gmail.comwrote:

 banned!!!

 On Mon, Jun 27, 2011 at 5:32 PM, shady sinv...@gmail.com wrote:

 if moderators are alive, can they ban him ?


 On Mon, Jun 27, 2011 at 12:48 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

  *Statement Riddle  - 27 june
 * * *
 *
 *
 **
 *'Ferari driver' easily beats the 'force indain driver' in a two care
 race.How did Indian newspapers *
 *truthfully report so to look as 'force indain drive' had outdone the
 'ferari driver'
 Think ??
 *
 *Update Your Answers at* : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?lavesh=lavesh

 *Solution:*
 Will be updated after 1 day




 --

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

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





 --
 yezhu malai vaasa venkataramana Govinda Govinda




-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Cisco Question

2011-06-27 Thread rShetty
Given a byte, write a code to swap every two bits. [Using bit
operators]

 Eg: Input: 10 01 11 01 Output: 01 10 11 10

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-27 Thread Bhavesh agrawal
can anyone plz post the code for this problem

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Dave
@Nishant: No need to store the data in an array. Do two inorder
traversals simultaneously. Let u and v be the current nodes of the two
traversals, respectively. If u + v  x, then advance the v
traversal. If u + v  x, advance the u traversal.

Dave

On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
 do inorder traversal of tree and store values in an array.
 Now find pairs by applying binary search on array..

 On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:





  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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: Cisco Question

2011-06-27 Thread Dave
y = ((x  0x55)  1) | ((x  1)  0x55).

Note, 0x55 = 01010101 in binary.

Dave

On Jun 27, 7:18 am, rShetty rajeevr...@gmail.com wrote:
 Given a byte, write a code to swap every two bits. [Using bit
 operators]

  Eg: Input: 10 01 11 01 Output: 01 10 11 10

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Statement Riddle

2011-06-27 Thread Dave
Force indain driver finishes second in race. Ferari was next to last.

Dave



On Jun 27, 2:18 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 *Statement Riddle  - 27 june
  *
 *
 *
 **
 *'Ferari driver' easily beats the 'force indain driver' in a two care
 race.How did Indian newspapers *
 *truthfully report so to look as 'force indain drive' had outdone the
 'ferari driver'
 Think ??
 *
 *Update Your Answers at* : Click
 Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?la...

 *Solution:*
 Will be updated after 1 day

 --

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

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



Re: [algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread sunny agrawal
@Dave
i think your solution won't work
consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
initially both u,v (1,1)
according to u your algorithm will proceed like
(1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  - (15,15)

and clearly in second step of your solution if (u+v)  x after advancing u
still u+v will be greater than x
so something is wrong
I think your solution will work in case we need to find 2 nodes with
difference x.

correct me if i am wrong.!!

On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:

 @Nishant: No need to store the data in an array. Do two inorder
 traversals simultaneously. Let u and v be the current nodes of the two
 traversals, respectively. If u + v  x, then advance the v
 traversal. If u + v  x, advance the u traversal.

 Dave

 On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 
 
 
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.




-- 
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: Cisco Question

2011-06-27 Thread rajeev bharshetty
@ Dave How to think about the answer to the above question . I mean How do I
tackle such problems ?

On Mon, Jun 27, 2011 at 6:17 PM, Dave dave_and_da...@juno.com wrote:

 y = ((x  0x55)  1) | ((x  1)  0x55).

 Note, 0x55 = 01010101 in binary.

 Dave

 On Jun 27, 7:18 am, rShetty rajeevr...@gmail.com wrote:
  Given a byte, write a code to swap every two bits. [Using bit
  operators]
 
   Eg: Input: 10 01 11 01 Output: 01 10 11 10

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Cisco Question

2011-06-27 Thread piyush kapoor
Yep,I also want to know the same..

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

 @ Dave How to think about the answer to the above question . I mean How do
 I tackle such problems ?


 On Mon, Jun 27, 2011 at 6:17 PM, Dave dave_and_da...@juno.com wrote:

 y = ((x  0x55)  1) | ((x  1)  0x55).

 Note, 0x55 = 01010101 in binary.

 Dave

 On Jun 27, 7:18 am, rShetty rajeevr...@gmail.com wrote:
  Given a byte, write a code to swap every two bits. [Using bit
  operators]
 
   Eg: Input: 10 01 11 01 Output: 01 10 11 10

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


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




-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread vaibhav agarwal
@varun: where does the algo stops?
  when the two pointer crosses over or both of them reaches other
opposite end.

On Mon, Jun 27, 2011 at 3:04 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 Instead of using an array...we can do this by converting the BST into a
 doubly linked list...but this will definitely modify the BST..


 On Mon, Jun 27, 2011 at 3:01 PM, varun pahwa varunpahwa2...@gmail.comwrote:

 @ankit: no need to use hash table for that.
 simply run two pointers one from 0 and second from n - 1.

 On Mon, Jun 27, 2011 at 2:51 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @Bharath : Cud u plz explain how r u searching the elements in O(n) time?
 Because if we use binary search, it will have O(n*log n )  worst case
 time complexity. One way in which I think it cud be made O(n) is that
 we can use a hash table, with a good hash function apart frm the
 array. And then for each element 'm' in the array, we cud search if
 there is an element (sum - m) in O(1) time by using hash table. Still
 we can't assure O(n) time complexity. Because coming up with a good
 hash function is not easy. Again, hash table takes more space




 On Mon, Jun 27, 2011 at 1:40 AM, Nishant Mittal
 mittal.nishan...@gmail.com wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




 --
 Varun Pahwa
 B.Tech (IT)
 7th Sem.
 Indian Institute of Information Technology Allahabad.
 Ph : 09793899112 ,08011820777
 Official Email :: rit2008...@iiita.ac.in
 Another Email :: varunpahwa.ii...@gmail.com

 People who fail to plan are those who plan to fail.

 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Anyone have The google resume book

2011-06-27 Thread Vivek Srivastava
Hi swathi,

What do you mean exactly by the google resume book?

On Sun, Jun 26, 2011 at 10:50 PM, Swathi chukka.swa...@gmail.com wrote:


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Nagarro Question

2011-06-27 Thread juver++
Here it is: http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf

On Jun 27, 5:02 am, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
 Need a Better Algorithm

 here is a trivial question we are given an array of 2n elements in the
 form
 {a1,a2,a3,..,an,b1,b2,b3b...bn}

 we need to output a resultiing array in the form
 {a1,b1,a2,b2,an,bn}
 but without using another array here is my algorithm which uses nested
 loops can anyone provide a better solution which doesnt involve
 shifting.

 int i,j,k,temp;
 j=num;

 int Interleave(int *arr)
 {

     for(i=1;i2*num - 1;i+=2)
     {
       temp = arr[j];

       for(k=j;k=i+1;--k)
       arr[k]=arr[k-1];

       arr[i] = temp;
       ++j;
     }







 }

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



[algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread juver++
It doesn't work. In your idea values of nodes represented by u and v always 
increased, cause you are doing inorder traversal.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/xgtSqFIJwjMJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Dave
@Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
Do two inorder traversals, one in the usual (descend to the left
before descendung to the right) direction and the other in the
reversed(descend to the right before descending to the left)
direction. Let u and r be the current nodee of the two traversals,
respectively. If u + r  x, then advance the usual traversal and
repeat the comparison. If u + r  x, advance the reverse traversal and
repeat the comparison. If u + r = x, and if u != r, then terminate
with success. If u = r, then terminate with failure.

Dave

On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
 @Dave
 i think your solution won't work
 consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
 initially both u,v (1,1)
 according to u your algorithm will proceed like
 (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  - (15,15)

 and clearly in second step of your solution if (u+v)  x after advancing u
 still u+v will be greater than x
 so something is wrong
 I think your solution will work in case we need to find 2 nodes with
 difference x.

 correct me if i am wrong.!!





 On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:
  @Nishant: No need to store the data in an array. Do two inorder
  traversals simultaneously. Let u and v be the current nodes of the two
  traversals, respectively. If u + v  x, then advance the v
  traversal. If u + v  x, advance the u traversal.

  Dave

  On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
   do inorder traversal of tree and store values in an array.
   Now find pairs by applying binary search on array..

   On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:

--
You received this message because you are subscribed to the Google
  Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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.

 --
 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread juver++
Yes, now it is fine enough :)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8z1hcl2hQskJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Anyone have The google resume book

2011-06-27 Thread Swathi
This book

http://www.amazon.com/gp/product/0470927623/ref=as_li_ss_tl?ie=UTF8tag=care01-20linkCode=as2camp=1789creative=390957creativeASIN=0470927623

Thanks,
swathi

On Mon, Jun 27, 2011 at 6:50 PM, Vivek Srivastava 
srivastava.vivek1...@gmail.com wrote:

 Hi swathi,

 What do you mean exactly by the google resume book?

 On Sun, Jun 26, 2011 at 10:50 PM, Swathi chukka.swa...@gmail.com wrote:


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Swathi
Dave,

Can you provide the psuedo code for this..

Thanks,
Swathi

On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:

 @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
 Do two inorder traversals, one in the usual (descend to the left
 before descendung to the right) direction and the other in the
 reversed(descend to the right before descending to the left)
 direction. Let u and r be the current nodee of the two traversals,
 respectively. If u + r  x, then advance the usual traversal and
 repeat the comparison. If u + r  x, advance the reverse traversal and
 repeat the comparison. If u + r = x, and if u != r, then terminate
 with success. If u = r, then terminate with failure.

 Dave

 On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
  @Dave
  i think your solution won't work
  consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
  initially both u,v (1,1)
  according to u your algorithm will proceed like
  (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
 (15,15)
 
  and clearly in second step of your solution if (u+v)  x after advancing
 u
  still u+v will be greater than x
  so something is wrong
  I think your solution will work in case we need to find 2 nodes with
  difference x.
 
  correct me if i am wrong.!!
 
 
 
 
 
  On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:
   @Nishant: No need to store the data in an array. Do two inorder
   traversals simultaneously. Let u and v be the current nodes of the two
   traversals, respectively. If u + v  x, then advance the v
   traversal. If u + v  x, advance the u traversal.
 
   Dave
 
   On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
do inorder traversal of tree and store values in an array.
Now find pairs by applying binary search on array..
 
On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 --
 You received this message because you are subscribed to the Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
 
  --
  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.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 C#.NET Developer in Columbus, OH 6+ Months

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

 

We have a hot opening for...

 

Job Title: C#.NET Developer

Location: Columbus, OH

Duration: 6+ Months 

 

Must be onsite interview.

 

Job Profile:

 

These resources will be developing multiple applications. 

Experience with C#, .NET, Agile, TFS and Java Scripts is a must. 

A candidate with experience in EXTJS would be most desired.

 

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

2011-06-27 Thread rShetty
Reversing a String without using a temporary variable ?


Rajeev N B

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Bharath Soma
@ankit, sorry i was mistaken its O(nlogn) for searching the two elements...

On Mon, Jun 27, 2011 at 8:04 PM, Swathi chukka.swa...@gmail.com wrote:

 Dave,

 Can you provide the psuedo code for this..

 Thanks,
 Swathi


 On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:

 @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
 Do two inorder traversals, one in the usual (descend to the left
 before descendung to the right) direction and the other in the
 reversed(descend to the right before descending to the left)
 direction. Let u and r be the current nodee of the two traversals,
 respectively. If u + r  x, then advance the usual traversal and
 repeat the comparison. If u + r  x, advance the reverse traversal and
 repeat the comparison. If u + r = x, and if u != r, then terminate
 with success. If u = r, then terminate with failure.

 Dave

 On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
  @Dave
  i think your solution won't work
  consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
  initially both u,v (1,1)
  according to u your algorithm will proceed like
  (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
 (15,15)
 
  and clearly in second step of your solution if (u+v)  x after advancing
 u
  still u+v will be greater than x
  so something is wrong
  I think your solution will work in case we need to find 2 nodes with
  difference x.
 
  correct me if i am wrong.!!
 
 
 
 
 
  On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:
   @Nishant: No need to store the data in an array. Do two inorder
   traversals simultaneously. Let u and v be the current nodes of the two
   traversals, respectively. If u + v  x, then advance the v
   traversal. If u + v  x, advance the u traversal.
 
   Dave
 
   On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com
 wrote:
do inorder traversal of tree and store values in an array.
Now find pairs by applying binary search on array..
 
On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 --
 You received this message because you are subscribed to the Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
 
  --
  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.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Bharath

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread varun pahwa
suppose k is the sum to be found.
@vaibhav: yes it will stop when crossing is there means (j must be greater
than i).initially sum = a[i] + a[j] (where i = 0 n j = n- 1) n we will
increase i when sum is less than k and decrease j when sum  k.stop if sum
== k. and  if no i , j found till j  i. then pairs not possible,

On Mon, Jun 27, 2011 at 8:28 AM, Bharath Soma bharath.s...@gmail.comwrote:

 @ankit, sorry i was mistaken its O(nlogn) for searching the two elements...


 On Mon, Jun 27, 2011 at 8:04 PM, Swathi chukka.swa...@gmail.com wrote:

 Dave,

 Can you provide the psuedo code for this..

 Thanks,
 Swathi


 On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:

 @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
 Do two inorder traversals, one in the usual (descend to the left
 before descendung to the right) direction and the other in the
 reversed(descend to the right before descending to the left)
 direction. Let u and r be the current nodee of the two traversals,
 respectively. If u + r  x, then advance the usual traversal and
 repeat the comparison. If u + r  x, advance the reverse traversal and
 repeat the comparison. If u + r = x, and if u != r, then terminate
 with success. If u = r, then terminate with failure.

 Dave

 On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
  @Dave
  i think your solution won't work
  consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
  initially both u,v (1,1)
  according to u your algorithm will proceed like
  (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
 (15,15)
 
  and clearly in second step of your solution if (u+v)  x after
 advancing u
  still u+v will be greater than x
  so something is wrong
  I think your solution will work in case we need to find 2 nodes with
  difference x.
 
  correct me if i am wrong.!!
 
 
 
 
 
  On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:
   @Nishant: No need to store the data in an array. Do two inorder
   traversals simultaneously. Let u and v be the current nodes of the
 two
   traversals, respectively. If u + v  x, then advance the v
   traversal. If u + v  x, advance the u traversal.
 
   Dave
 
   On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com
 wrote:
do inorder traversal of tree and store values in an array.
Now find pairs by applying binary search on array..
 
On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
 
  --
  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.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Bharath


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




-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112 ,08011820777
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more 

Re: [algogeeks] Re: Cisco Question

2011-06-27 Thread piyush kapoor
thanks a lot for the wonderful explanation :-)

On Mon, Jun 27, 2011 at 7:17 PM, Dave dave_and_da...@juno.com wrote:

 @Rajeev and Piyush: Numbering the bits from the right starting with 0
 as usual, you see that you need to move the even-numbered bits one bit
 to the left and the odd-numbered bits one bit to the right. You could
 do this one bit-pair at a time, but it would be more efficient if you
 could do all pairs simultaneously. So how can you pick out all of the
 even-numbered bits at the same time? By using the logical and of the
 data with a mask that has 0s in the odd bit positions and 1s in the
 even bit positions. I.e., anding x with 01010101 in binary, which is
 0x55 in hexadecimal. Once you have isolated the even numbered bits,
 you shift them left one place. The result is (x  0x55)  1.
 Similarly, you want to isolate the odd-numbered bits and shift them
 right one place. You could do that by anding with the mask 10101010
 (binary) = 0xAA, and then shifting right: (x  0xAA)  1. This
 introduces another constant, which might not be as efficient as
 reusing the previous constant 0x55, which can be done by shifting
 right first and then anding: (x  1)  0x55. Now that we have the two
 sets of bits in the correct positions, we simply need to combine them,
 and the logical or operator does that just fine. The overall result is
 (x  0x55)  1) | ((x  1)  0x55).

 Dave

 On Jun 27, 7:53 am, piyush kapoor pkjee2...@gmail.com wrote:
  Yep,I also want to know the same..
 
  On Mon, Jun 27, 2011 at 6:23 PM, rajeev bharshetty rajeevr...@gmail.com
 wrote:
 
 
 
 
 
   @ Dave How to think about the answer to the above question . I mean How
 do
   I tackle such problems ?
 
   On Mon, Jun 27, 2011 at 6:17 PM, Dave dave_and_da...@juno.com wrote:
 
   y = ((x  0x55)  1) | ((x  1)  0x55).
 
   Note, 0x55 = 01010101 in binary.
 
   Dave
 
   On Jun 27, 7:18 am, rShetty rajeevr...@gmail.com wrote:
Given a byte, write a code to swap every two bits. [Using bit
operators]
 
 Eg: Input: 10 01 11 01 Output: 01 10 11 10
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  *Regards,*
  *Piyush Kapoor,*
  *CSE-IT-BHU*- Hide quoted text -
 
  - Show quoted text -

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




-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: MS question

2011-06-27 Thread Sanket
Do we really need to reverse? Can't we apply any normal sorting algo
like merge sort or quick sort and for the comparison part of it, use
the last characters of each string only?

On Jun 27, 4:21 am, varun pahwa varunpahwa2...@gmail.com wrote:
 reverse all strings and then sort.

 On Mon, Jun 27, 2011 at 2:28 PM, Nishant Mittal
 mittal.nishan...@gmail.comwrote:

  WAP to sort an array of character strings on the basis of last
  character of each string
  eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}

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

 --
 Varun Pahwa
 B.Tech (IT)
 7th Sem.
 Indian Institute of Information Technology Allahabad.
 Ph : 09793899112 ,08011820777
 Official Email :: rit2008...@iiita.ac.in
 Another Email :: varunpahwa.ii...@gmail.com

 People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-27 Thread Sanket
@Dave - Wouldn't your solution also become O(kn) where k = number of
bits in the number?
In this summation - O(n) + O(n/2) + O(n/4) + ...= O(n) - you would
have O(n) appearing 'k' times. Each entry is O(n/ 2^i) where 'i' is
the bit position from right to left, starting at 0. The range of 'i'
is from 0 to 'k-1'
Please correct me if I am wrong.

On Jun 27, 7:29 am, Bhavesh agrawal agr.bhav...@gmail.com wrote:
 can anyone plz post the code for this problem

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



Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread pacific :-)
Can one of you provide some hints in solving this problem ?

On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan kartik.sac...@gmail.comwrote:

 @jitendra that's what i am asking forwhat algo i should
 implement  to get process in 1 sec?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



Re: [algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread vaibhav agarwal
@varun: Thanks...

On Mon, Jun 27, 2011 at 9:18 PM, varun pahwa varunpahwa2...@gmail.comwrote:

 suppose k is the sum to be found.
 @vaibhav: yes it will stop when crossing is there means (j must be greater
 than i).initially sum = a[i] + a[j] (where i = 0 n j = n- 1) n we will
 increase i when sum is less than k and decrease j when sum  k.stop if sum
 == k. and  if no i , j found till j  i. then pairs not possible,

 On Mon, Jun 27, 2011 at 8:28 AM, Bharath Soma bharath.s...@gmail.comwrote:

 @ankit, sorry i was mistaken its O(nlogn) for searching the two
 elements...


 On Mon, Jun 27, 2011 at 8:04 PM, Swathi chukka.swa...@gmail.com wrote:

 Dave,

 Can you provide the psuedo code for this..

 Thanks,
 Swathi


 On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:

 @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
 Do two inorder traversals, one in the usual (descend to the left
 before descendung to the right) direction and the other in the
 reversed(descend to the right before descending to the left)
 direction. Let u and r be the current nodee of the two traversals,
 respectively. If u + r  x, then advance the usual traversal and
 repeat the comparison. If u + r  x, advance the reverse traversal and
 repeat the comparison. If u + r = x, and if u != r, then terminate
 with success. If u = r, then terminate with failure.

 Dave

 On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
  @Dave
  i think your solution won't work
  consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
  initially both u,v (1,1)
  according to u your algorithm will proceed like
  (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
 (15,15)
 
  and clearly in second step of your solution if (u+v)  x after
 advancing u
  still u+v will be greater than x
  so something is wrong
  I think your solution will work in case we need to find 2 nodes with
  difference x.
 
  correct me if i am wrong.!!
 
 
 
 
 
  On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com
 wrote:
   @Nishant: No need to store the data in an array. Do two inorder
   traversals simultaneously. Let u and v be the current nodes of the
 two
   traversals, respectively. If u + v  x, then advance the v
   traversal. If u + v  x, advance the u traversal.
 
   Dave
 
   On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com
 wrote:
do inorder traversal of tree and store values in an array.
Now find pairs by applying binary search on array..
 
On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com
 .
 To unsubscribe from 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.
 
  --
  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.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Bharath


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




 --
 Varun Pahwa
 B.Tech (IT)
 7th Sem.
 Indian Institute of Information Technology Allahabad.
 Ph : 09793899112 ,08011820777
 Official Email :: rit2008...@iiita.ac.in
 Another Email :: varunpahwa.ii...@gmail.com

 People who fail to plan are those who plan to fail.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to 

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread harshit pahuja
hint is :  go for counting  ,not for shifting   o(n).  :P

On Mon, Jun 27, 2011 at 9:29 PM, pacific :-) pacific4...@gmail.com wrote:

 Can one of you provide some hints in solving this problem ?


 On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan kartik.sac...@gmail.comwrote:

 @jitendra that's what i am asking forwhat algo i should
 implement  to get process in 1 sec?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
HARSHIT PAHUJA
M.N.N.I.T.
ALLAHABAD

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



[algogeeks] Re: Finding a number from 300million list with constraint on memory.

2011-06-27 Thread Sanket
That is true Dave. Since the numbers are random, we could very well
have that scenario. To reduce this possibility, we can reverse the
allocation - 1.5MB for the array and 500KB for the input. Since the
input is going to be read sequentially, we would need to swap only
after exhausting all the numbers in the 500KB block. However, even
after this, in the worst worst case, the possibility you bring up
would exist :-)
The other thing to consider is the time it would take to read the
entire input again, and the related I/O swapping for the input as well
as the array (if we are using your approach).

On Jun 26, 2:48 pm, Dave dave_and_da...@juno.com wrote:
 @Sankeet: How do you know that you wouldn't do more i/o for swapping
 than just reading the data twice? Since the input numbers are not
 sorted, it seems that you could be swapping a different block in for
 every number.

 Dave

 On Jun 26, 2:12 pm, Sanket vasa.san...@gmail.com wrote:

  A small tweak (and possible optimization) to Dave's algorithm mighe be
  to use bit based array. That is, have an array of 12500 byte
  values where for each byte, the 8 bits represent a flag of whether
  that particular number is present in the file or not.
  So, a[0] would indicate whether numbers 1 - 10007 are
  present in the file or not.
  Now, we scan the file number by number, and for each number scanned,
  we convert the number into an index into the array and set the
  corresponding bit.
  After the entire file has been scanned, the task of finding a number
  not present in the file simply is to scan the array and find a bit
  which has not been set.
  To overcome the RAM limitation, we can keep 500KB of space for a chunk
  of the array which would be swapped in/out based on the values read
  from the file and the remaining 1.5MB would be used for the file
  contents.

  On Jun 23, 11:24 pm, Douglas Diniz dgdi...@gmail.com wrote:

   Well, I understood that you have a number (say x) and you want if the
   number x is not in the file. Atul wrote:

   The numbers are all distinct. they may vary from 100,000,000 to
   999,999,999 and there are roughly 300 million (ie. 300 * 1000,000
   numbers approx.). So there are 600*1000,000 number which are not in
   the file and we are asked to return any one these 600*1000,000 numbers
   given the memory constraints. Moreover the numbers are in random
   order. 

   And in the first email:

   Find a 9-digit number that isn't present in the file.

   The description is ambiguous. But I think you are right. My
   interpretation was wrong.

   On Fri, Jun 24, 2011 at 1:06 AM, Dave dave_and_da...@juno.com wrote:
@Douglas: I was assuming that the file contains the numbers in ASCII,
and that normal file buffering is being used. If you think that I need
to include the buffers in the given storage, then fine: just use half
for buffers and half for the array of counters. The only change to the
algorithm would be to replace 100 everywhere with 50.

I find your description below a bit confusing, where you say that you
will search for the number sequentially. What number are you searching
for? The problem is to find a number that is not in the file, not to
check to see if a given number is not in the file. Suppose that the
file contains account numbers; the problem is to find an unused
account number. So how do you search sequentially through a file to
find a number that is not in the file? If I have misinterpreted what
you wrote, please present your entire algorithm.

Dave

On Jun 23, 10:18 pm, Douglas Diniz dgdi...@gmail.com wrote:
Dave, I think you method is very slow. If you have a array of 100
of 16 bits integers this mean that all the Ram is in use, and you will
need at least 300x10^6 disk access, because you will need the read the
numbers one by one from the file, and this will take a LOT of time.
And your method use the module operation % for every number, which is 
slow.
I think the basic algorithm of read blocks of 2MB to Ram and searching
for the number sequentially until you find the number or reach the end
of file, is some order of magnitude better, because you read the
blocks linearly from the disk, which is much, much better than read
one by one, and you dont have to calculate the %.

On Thu, Jun 23, 2011 at 11:24 PM, Dave dave_and_da...@juno.com wrote:
 @Atul: Here is one way to do it:

 Treat the array as a million 16-bit integers: short a[100].

 Set the array to zero.

 Read through the file, and for each number k, increment a[k%100].
 Since the numbers are distinct, there can be at most 900 numbers in
 each bin.

 Find j such that a[j]  900. You now know that there is a missing
 number with the six-digit number j as the final six digits.

 Set a[100] to a[999] to zero.

 Read through the array again. Ignore any number k whose last six
 

Re: [algogeeks] Re: Statement Riddle

2011-06-27 Thread Vishal Thanki
this may be  a reverse race, who comes last will win..

On Mon, Jun 27, 2011 at 6:22 PM, Dave dave_and_da...@juno.com wrote:
 Force indain driver finishes second in race. Ferari was next to last.

 Dave



 On Jun 27, 2:18 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 *Statement Riddle  - 27 june
  *
 *
 *
 **
 *'Ferari driver' easily beats the 'force indain driver' in a two care
 race.How did Indian newspapers *
 *truthfully report so to look as 'force indain drive' had outdone the
 'ferari driver'
 Think ??
 *
 *Update Your Answers at* : Click
 Herehttp://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?la...

 *Solution:*
 Will be updated after 1 day

 --

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

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



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: OS

2011-06-27 Thread Sanket
@Mihir - Yea, I missed the semi-colon, got it now :-)

On Jun 27, 2:00 am, Mihir mihirmpa...@gmail.com wrote:
 @Sanket: You are wrong. Check the loops again!

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Nagarro Question

2011-06-27 Thread Sanket
@Juver - I am getting Access denied for the pdf link you sent :(

On Jun 27, 8:48 am, juver++ avpostni...@gmail.com wrote:
 Here it is:http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf

 On Jun 27, 5:02 am, Ankit Sablok ankitsablok19091...@gmail.com
 wrote:

  Need a Better Algorithm

  here is a trivial question we are given an array of 2n elements in the
  form
  {a1,a2,a3,..,an,b1,b2,b3b...bn}

  we need to output a resultiing array in the form
  {a1,b1,a2,b2,an,bn}
  but without using another array here is my algorithm which uses nested
  loops can anyone provide a better solution which doesnt involve
  shifting.

  int i,j,k,temp;
  j=num;

  int Interleave(int *arr)
  {

      for(i=1;i2*num - 1;i+=2)
      {
        temp = arr[j];

        for(k=j;k=i+1;--k)
        arr[k]=arr[k-1];

        arr[i] = temp;
        ++j;
      }

  }

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



Re: [algogeeks] Reverse

2011-06-27 Thread Kamakshii Aggarwal
#include stdio.h
#include stdlib.h

void revers(char *s)
{

 if(*s)
 {
revers(++s);
s--;
printf(%c ,*s);
 }

}

int main(int argc, char *argv[])
{
char arr[]=string;
revers(arr);

  system(PAUSE);
  return 0;
}
will s be counted as temporary variable in this?

On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com wrote:

 Reversing a String without using a temporary variable ?


 Rajeev N B

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




-- 
Regards,
Kamakshi
kamakshi...@gmail.com

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



Re: [algogeeks] Reverse

2011-06-27 Thread Vishal Thanki
this code will only print, it will not store the reverse string.

On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
kamakshi...@gmail.com wrote:
 #include stdio.h
 #include stdlib.h
 void revers(char *s)
 {
      if(*s)
      {
                     revers(++s);
                     s--;
                     printf(%c ,*s);
      }

 }
 int main(int argc, char *argv[])
 {
     char arr[]=string;
     revers(arr);

   system(PAUSE);
   return 0;
 }
 will s be counted as temporary variable in this?
 On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com wrote:

 Reversing a String without using a temporary variable ?


 Rajeev N B

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




 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

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


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



Re: [algogeeks] Reverse

2011-06-27 Thread Vishal Thanki
and yes, s will be stored in stack everytime you call the function,
so its a temp variable..

string reverse is a simple logic, just iterate i through 1 to n/2 and
swap the i to n-i

On Mon, Jun 27, 2011 at 10:06 PM, Vishal Thanki vishaltha...@gmail.com wrote:
 this code will only print, it will not store the reverse string.

 On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
 kamakshi...@gmail.com wrote:
 #include stdio.h
 #include stdlib.h
 void revers(char *s)
 {
      if(*s)
      {
                     revers(++s);
                     s--;
                     printf(%c ,*s);
      }

 }
 int main(int argc, char *argv[])
 {
     char arr[]=string;
     revers(arr);

   system(PAUSE);
   return 0;
 }
 will s be counted as temporary variable in this?
 On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com wrote:

 Reversing a String without using a temporary variable ?


 Rajeev N B

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




 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

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



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



Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread vaibhav agarwal
consider G as 1, B as 0
so actually its series of 1 and 0's

now consider any sequence GBGBBGGGBG will be represented as
1010011101

objective is to push all 1's at the right end.
all '10' pairs need to be swapped at the same time.
considering this take for ex 101
the number of swaps is equal to the number of zeroes b/w two consecutive 1's
if the number of zeroes turn out to be 0 that is we have series of 1's in
the sequence then the number of swaps is equal to length of the series of
1's -1 .
leading zeroes is nt a problem and hence can be left in calculation.
add all that is ur answer.

case 1:  11001
 will require 1(first two 1's are consecutive so 2 - 1 )+2(zeroes b/w two
consecutive 1's) = 3
 10101,01011,00111

case 2: 1001 only 2(two zeroes)
0101,0011

case 3: 111011001
   will require 2(3 consecutive 1's)+1(single zero between 3rd and 4th
'1')+1(2 consecutive 1's)+2(two zeroes b/w last two 1's) = 6
110110101,101101011,011010111,01010,00101,00011

it wrking f9 with this .
correct me if i am wrng.

On Mon, Jun 27, 2011 at 9:33 PM, harshit pahuja hpahuja.mn...@gmail.comwrote:

 hint is :  go for counting  ,not for shifting   o(n).  :P


 On Mon, Jun 27, 2011 at 9:29 PM, pacific :-) pacific4...@gmail.comwrote:

 Can one of you provide some hints in solving this problem ?


 On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan 
 kartik.sac...@gmail.comwrote:

 @jitendra that's what i am asking forwhat algo i should
 implement  to get process in 1 sec?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
 HARSHIT PAHUJA
 M.N.N.I.T.
 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] Reverse

2011-06-27 Thread vaibhav shukla
and how will swap without using temp variable ?

On Mon, Jun 27, 2011 at 10:07 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 and yes, s will be stored in stack everytime you call the function,
 so its a temp variable..

 string reverse is a simple logic, just iterate i through 1 to n/2 and
 swap the i to n-i

 On Mon, Jun 27, 2011 at 10:06 PM, Vishal Thanki vishaltha...@gmail.com
 wrote:
  this code will only print, it will not store the reverse string.
 
  On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
  kamakshi...@gmail.com wrote:
  #include stdio.h
  #include stdlib.h
  void revers(char *s)
  {
   if(*s)
   {
  revers(++s);
  s--;
  printf(%c ,*s);
   }
 
  }
  int main(int argc, char *argv[])
  {
  char arr[]=string;
  revers(arr);
 
system(PAUSE);
return 0;
  }
  will s be counted as temporary variable in this?
  On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com wrote:
 
  Reversing a String without using a temporary variable ?
 
 
  Rajeev N B
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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




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



Re: [algogeeks] Reverse

2011-06-27 Thread vaibhav agarwal
@vaibhav just like u swap two int variable without using 3rd

On Mon, Jun 27, 2011 at 10:17 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 and how will swap without using temp variable ?


 On Mon, Jun 27, 2011 at 10:07 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 and yes, s will be stored in stack everytime you call the function,
 so its a temp variable..

 string reverse is a simple logic, just iterate i through 1 to n/2 and
 swap the i to n-i

 On Mon, Jun 27, 2011 at 10:06 PM, Vishal Thanki vishaltha...@gmail.com
 wrote:
  this code will only print, it will not store the reverse string.
 
  On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
  kamakshi...@gmail.com wrote:
  #include stdio.h
  #include stdlib.h
  void revers(char *s)
  {
   if(*s)
   {
  revers(++s);
  s--;
  printf(%c ,*s);
   }
 
  }
  int main(int argc, char *argv[])
  {
  char arr[]=string;
  revers(arr);
 
system(PAUSE);
return 0;
  }
  will s be counted as temporary variable in this?
  On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com wrote:
 
  Reversing a String without using a temporary variable ?
 
 
  Rajeev N B
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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




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


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Reverse

2011-06-27 Thread vaibhav shukla
h.yup

On Mon, Jun 27, 2011 at 10:18 PM, vaibhav agarwal 
vibhu.bitspil...@gmail.com wrote:

 @vaibhav just like u swap two int variable without using 3rd

 On Mon, Jun 27, 2011 at 10:17 PM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 and how will swap without using temp variable ?


 On Mon, Jun 27, 2011 at 10:07 PM, Vishal Thanki 
 vishaltha...@gmail.comwrote:

 and yes, s will be stored in stack everytime you call the function,
 so its a temp variable..

 string reverse is a simple logic, just iterate i through 1 to n/2 and
 swap the i to n-i

 On Mon, Jun 27, 2011 at 10:06 PM, Vishal Thanki vishaltha...@gmail.com
 wrote:
  this code will only print, it will not store the reverse string.
 
  On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
  kamakshi...@gmail.com wrote:
  #include stdio.h
  #include stdlib.h
  void revers(char *s)
  {
   if(*s)
   {
  revers(++s);
  s--;
  printf(%c ,*s);
   }
 
  }
  int main(int argc, char *argv[])
  {
  char arr[]=string;
  revers(arr);
 
system(PAUSE);
return 0;
  }
  will s be counted as temporary variable in this?
  On Mon, Jun 27, 2011 at 8:57 PM, rShetty rajeevr...@gmail.com
 wrote:
 
  Reversing a String without using a temporary variable ?
 
 
  Rajeev N B
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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




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


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



[algogeeks] Re: Cisco Question

2011-06-27 Thread rShetty
@Dave Thank You very much :)

On Jun 27, 8:48 pm, piyush kapoor pkjee2...@gmail.com wrote:
 thanks a lot for the wonderful explanation :-)









 On Mon, Jun 27, 2011 at 7:17 PM, Dave dave_and_da...@juno.com wrote:
  @Rajeev and Piyush: Numbering the bits from the right starting with 0
  as usual, you see that you need to move the even-numbered bits one bit
  to the left and the odd-numbered bits one bit to the right. You could
  do this one bit-pair at a time, but it would be more efficient if you
  could do all pairs simultaneously. So how can you pick out all of the
  even-numbered bits at the same time? By using the logical and of the
  data with a mask that has 0s in the odd bit positions and 1s in the
  even bit positions. I.e., anding x with 01010101 in binary, which is
  0x55 in hexadecimal. Once you have isolated the even numbered bits,
  you shift them left one place. The result is (x  0x55)  1.
  Similarly, you want to isolate the odd-numbered bits and shift them
  right one place. You could do that by anding with the mask 10101010
  (binary) = 0xAA, and then shifting right: (x  0xAA)  1. This
  introduces another constant, which might not be as efficient as
  reusing the previous constant 0x55, which can be done by shifting
  right first and then anding: (x  1)  0x55. Now that we have the two
  sets of bits in the correct positions, we simply need to combine them,
  and the logical or operator does that just fine. The overall result is
  (x  0x55)  1) | ((x  1)  0x55).

  Dave

  On Jun 27, 7:53 am, piyush kapoor pkjee2...@gmail.com wrote:
   Yep,I also want to know the same..

   On Mon, Jun 27, 2011 at 6:23 PM, rajeev bharshetty rajeevr...@gmail.com
  wrote:

@ Dave How to think about the answer to the above question . I mean How
  do
I tackle such problems ?

On Mon, Jun 27, 2011 at 6:17 PM, Dave dave_and_da...@juno.com wrote:

y = ((x  0x55)  1) | ((x  1)  0x55).

Note, 0x55 = 01010101 in binary.

Dave

On Jun 27, 7:18 am, rShetty rajeevr...@gmail.com wrote:
 Given a byte, write a code to swap every two bits. [Using bit
 operators]

  Eg: Input: 10 01 11 01 Output: 01 10 11 10

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

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

   --
   *Regards,*
   *Piyush Kapoor,*
   *CSE-IT-BHU*- Hide quoted text -

   - Show quoted text -

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

 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Office Suite

2011-06-27 Thread vaibhav agarwal
@radha: hw abt using a fixed size circular list?

On Sat, Jun 25, 2011 at 8:25 PM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 simple!!
  Stack:P

 On Sat, Jun 25, 2011 at 8:11 PM, rShetty rajeevr...@gmail.com wrote:
  Suggest the most efficient Data Structures and algorithms to implement
  Undo and Redo operations in any of the Office Suites ?
 
  --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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] Office Suite

2011-06-27 Thread radha krishnan
You asked the Most Efficient dude

On Mon, Jun 27, 2011 at 10:29 PM, vaibhav agarwal
vibhu.bitspil...@gmail.com wrote:
 @radha: hw abt using a fixed size circular list?

 On Sat, Jun 25, 2011 at 8:25 PM, radha krishnan
 radhakrishnance...@gmail.com wrote:

 simple!!
  Stack:P

 On Sat, Jun 25, 2011 at 8:11 PM, rShetty rajeevr...@gmail.com wrote:
  Suggest the most efficient Data Structures and algorithms to implement
  Undo and Redo operations in any of the Office Suites ?
 
  --
  You received this message because you are subscribed to the Google
  Groups Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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] MS

2011-06-27 Thread Akshata Sharma
you are given a system of passing binary trees among 2 ppl

Step1: convert the tree to preorder and inorder strings
Step2:send those strings to the intended person
Step3:get back tree from the strings

whats your strategy of testing?write various test scenarios.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Reverse

2011-06-27 Thread hary rathor
@vishal : dont you think that , i is also a variable?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Office Suite

2011-06-27 Thread vaibhav agarwal
@radha k but i think we need to store the bottom of the stack for deleting
the last node in O(1).
as we can click the redo or undo fixed number of times
and we would need two stacks
is that ok.

On Mon, Jun 27, 2011 at 10:31 PM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 You asked the Most Efficient dude

 On Mon, Jun 27, 2011 at 10:29 PM, vaibhav agarwal
 vibhu.bitspil...@gmail.com wrote:
  @radha: hw abt using a fixed size circular list?
 
  On Sat, Jun 25, 2011 at 8:25 PM, radha krishnan
  radhakrishnance...@gmail.com wrote:
 
  simple!!
   Stack:P
 
  On Sat, Jun 25, 2011 at 8:11 PM, rShetty rajeevr...@gmail.com wrote:
   Suggest the most efficient Data Structures and algorithms to implement
   Undo and Redo operations in any of the Office Suites ?
  
   --
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.



Re: [algogeeks] Reverse

2011-06-27 Thread sameer.mut...@gmail.com
guys temporary variable means not to store string in another variable.

On Mon, Jun 27, 2011 at 10:37 PM, hary rathor harry.rat...@gmail.comwrote:

 @vishal : dont you think that , i is also a variable?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: puzzle

2011-06-27 Thread Bhavesh agrawal
only ONE mouse ...consume each sample of bottles of bear with a difference
of one hour

and calculate time..


sry if is thr any stupidity in this answer..but i think it may be right

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-27 Thread sunny agrawal
@saket  - No
O(n) + O(n/2) + O(n/4)... = O(n)

sum of series
n+n/2+n/4+n/8 = 2n

On Mon, Jun 27, 2011 at 9:26 PM, Sanket vasa.san...@gmail.com wrote:

 @Dave - Wouldn't your solution also become O(kn) where k = number of
 bits in the number?
 In this summation - O(n) + O(n/2) + O(n/4) + ...= O(n) - you would
 have O(n) appearing 'k' times. Each entry is O(n/ 2^i) where 'i' is
 the bit position from right to left, starting at 0. The range of 'i'
 is from 0 to 'k-1'
 Please correct me if I am wrong.

 On Jun 27, 7:29 am, Bhavesh agrawal agr.bhav...@gmail.com wrote:
  can anyone plz post the code for this problem

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: puzzle

2011-06-27 Thread sunny agrawal
@Bhavesh

NO there is No stupity
just a mistake in reading the question

mice die within 14 hrs.Not exactly 14 hours :)

3 is correct answer.

On Mon, Jun 27, 2011 at 10:51 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 only ONE mouse ...consume each sample of bottles of bear with a difference
 of one hour

 and calculate time..


 sry if is thr any stupidity in this answer..but i think it may be right

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: puzzle

2011-06-27 Thread Bhavesh agrawal
ok , yeah 3 is the correct 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.



[algogeeks] Re: MS question

2011-06-27 Thread Dave
@Nishant: Here are a couple of O(n) alternatives, given that there are
a limited number of last characters and no requirement to break ties
in any particular way:

1. A counting sort.

2. Form a linked list of entries corresponding to each last character,
and then merge these lists in collating sequence.

Dave

On Jun 27, 3:58 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
 WAP to sort an array of character strings on the basis of last
 character of each string
 eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}

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



Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread kartik sachan
HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS
CASE GBGBBB

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Dave
@Swathi: No. I think the high level description should be adequate for
you to write your own code or pseudocode, albeit recognizing that you
may have to look up how to do an inorder traversal using a stack
instead of recursion.

Dave

On Jun 27, 9:34 am, Swathi chukka.swa...@gmail.com wrote:
 Dave,

 Can you provide the psuedo code for this..

 Thanks,
 Swathi



 On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:
  @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
  Do two inorder traversals, one in the usual (descend to the left
  before descendung to the right) direction and the other in the
  reversed(descend to the right before descending to the left)
  direction. Let u and r be the current nodee of the two traversals,
  respectively. If u + r  x, then advance the usual traversal and
  repeat the comparison. If u + r  x, advance the reverse traversal and
  repeat the comparison. If u + r = x, and if u != r, then terminate
  with success. If u = r, then terminate with failure.

  Dave

  On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
   @Dave
   i think your solution won't work
   consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
   initially both u,v (1,1)
   according to u your algorithm will proceed like
   (1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
  (15,15)

   and clearly in second step of your solution if (u+v)  x after advancing
  u
   still u+v will be greater than x
   so something is wrong
   I think your solution will work in case we need to find 2 nodes with
   difference x.

   correct me if i am wrong.!!

   On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com wrote:
@Nishant: No need to store the data in an array. Do two inorder
traversals simultaneously. Let u and v be the current nodes of the two
traversals, respectively. If u + v  x, then advance the v
traversal. If u + v  x, advance the u traversal.

Dave

On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com wrote:
 do inorder traversal of tree and store values in an array.
 Now find pairs by applying binary search on array..

 On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:

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

   --
   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.- Hide quoted text -

 - Show quoted text -

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



Re: [algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Swathi
Dave,

I am unable to write code for this so i am asking your help.

Thanks,
Swathi

On Mon, Jun 27, 2011 at 11:28 PM, Dave dave_and_da...@juno.com wrote:

 @Swathi: No. I think the high level description should be adequate for
 you to write your own code or pseudocode, albeit recognizing that you
 may have to look up how to do an inorder traversal using a stack
 instead of recursion.

 Dave

 On Jun 27, 9:34 am, Swathi chukka.swa...@gmail.com wrote:
  Dave,
 
  Can you provide the psuedo code for this..
 
  Thanks,
  Swathi
 
 
 
  On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:
   @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
   Do two inorder traversals, one in the usual (descend to the left
   before descendung to the right) direction and the other in the
   reversed(descend to the right before descending to the left)
   direction. Let u and r be the current nodee of the two traversals,
   respectively. If u + r  x, then advance the usual traversal and
   repeat the comparison. If u + r  x, advance the reverse traversal and
   repeat the comparison. If u + r = x, and if u != r, then terminate
   with success. If u = r, then terminate with failure.
 
   Dave
 
   On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
@Dave
i think your solution won't work
consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
initially both u,v (1,1)
according to u your algorithm will proceed like
(1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
   (15,15)
 
and clearly in second step of your solution if (u+v)  x after
 advancing
   u
still u+v will be greater than x
so something is wrong
I think your solution will work in case we need to find 2 nodes with
difference x.
 
correct me if i am wrong.!!
 
On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com
 wrote:
 @Nishant: No need to store the data in an array. Do two inorder
 traversals simultaneously. Let u and v be the current nodes of the
 two
 traversals, respectively. If u + v  x, then advance the v
 traversal. If u + v  x, advance the u traversal.
 
 Dave
 
 On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com
 wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.-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.
 
--
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.- 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] Reverse

2011-06-27 Thread hary rathor
this solution  according to sameer statement solution if there is any
problem then pls tell me . here string or char is not being
store anywhere

char * reverse(char  *str,int i ,int j)
{
while(ij)
{

str[i]=str[i]^str[j];
str[j]=str[i]^str[j];
str[i]=str[i]^str[j];
i++;j--;
}
return str;
}

int main ()
{
char str[]=harish;
printf(%s,reverse(str,0,sizeof(str)-2));
return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Reverse

2011-06-27 Thread Swathi
it works perfectly

On Mon, Jun 27, 2011 at 11:53 PM, hary rathor harry.rat...@gmail.comwrote:

 this solution  according to sameer statement solution if there is any
 problem then pls tell me . here string or char is not being
 store anywhere

 char * reverse(char  *str,int i ,int j)
 {
 while(ij)
 {

 str[i]=str[i]^str[j];
 str[j]=str[i]^str[j];
 str[i]=str[i]^str[j];
 i++;j--;
 }
 return str;
 }

 int main ()
 {
 char str[]=harish;
 printf(%s,reverse(str,0,sizeof(str)-2));
 return 0;

 }


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Yahoo Question

2011-06-27 Thread priyanshu
anyone!!!

On Jun 23, 3:28 pm, Priyanshu priyanshuro...@gmail.com wrote:
 You have 100 computers, connected with each other. Give the most efficient
 way to design a web crawler, which will crawl most pages in least amount of
 time.

 Thanks,
 Priyanshu.

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



[algogeeks] c/c++ : STREAM PROBLEM

2011-06-27 Thread hary rathor
if i am design algo which specify to not use the extra memory then if i use
the streams .
then is it consider as a extra memory?

-- 
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] Anyone have The google resume book

2011-06-27 Thread hary rathor
very funny ! every one know this site swathi

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Piyush Sinha
how about converting the BST into a doubly linked list...but this will
definitely modify the BST..

On Mon, Jun 27, 2011 at 11:32 PM, Swathi chukka.swa...@gmail.com wrote:

 Dave,

 I am unable to write code for this so i am asking your help.

 Thanks,
 Swathi


 On Mon, Jun 27, 2011 at 11:28 PM, Dave dave_and_da...@juno.com wrote:

 @Swathi: No. I think the high level description should be adequate for
 you to write your own code or pseudocode, albeit recognizing that you
 may have to look up how to do an inorder traversal using a stack
 instead of recursion.

 Dave

 On Jun 27, 9:34 am, Swathi chukka.swa...@gmail.com wrote:
  Dave,
 
  Can you provide the psuedo code for this..
 
  Thanks,
  Swathi
 
 
 
  On Mon, Jun 27, 2011 at 7:30 PM, Dave dave_and_da...@juno.com wrote:
   @Sunny. Mea culpa. You are correct. Revised (and correct) algorithm.
   Do two inorder traversals, one in the usual (descend to the left
   before descendung to the right) direction and the other in the
   reversed(descend to the right before descending to the left)
   direction. Let u and r be the current nodee of the two traversals,
   respectively. If u + r  x, then advance the usual traversal and
   repeat the comparison. If u + r  x, advance the reverse traversal and
   repeat the comparison. If u + r = x, and if u != r, then terminate
   with success. If u = r, then terminate with failure.
 
   Dave
 
   On Jun 27, 7:53 am, sunny agrawal sunny816.i...@gmail.com wrote:
@Dave
i think your solution won't work
consider inorder traversal of a BST is 1 6 7 8 15 and x = 14
initially both u,v (1,1)
according to u your algorithm will proceed like
(1,1) - (1,6) - (1,7) - (1,8) - (1,15) - (6,15)  -
   (15,15)
 
and clearly in second step of your solution if (u+v)  x after
 advancing
   u
still u+v will be greater than x
so something is wrong
I think your solution will work in case we need to find 2 nodes with
difference x.
 
correct me if i am wrong.!!
 
On Mon, Jun 27, 2011 at 6:13 PM, Dave dave_and_da...@juno.com
 wrote:
 @Nishant: No need to store the data in an array. Do two inorder
 traversals simultaneously. Let u and v be the current nodes of the
 two
 traversals, respectively. If u + v  x, then advance the v
 traversal. If u + v  x, advance the u traversal.
 
 Dave
 
 On Jun 27, 3:40 am, Nishant Mittal mittal.nishan...@gmail.com
 wrote:
  do inorder traversal of tree and store values in an array.
  Now find pairs by applying binary search on array..
 
  On 6/27/11, manish kapur manishkapur.n...@gmail.com wrote:
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.-Hidequotedtext -
 
  - 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- 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.- 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.




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

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread vaibhav agarwal
@kartik

yup frgt to mention the last case 1 followed by zero's in that case number
of iterations is the no. of trailing zeroes.
GBGBBB
will have four iterations
101000 = 1(one zero b/w two ones) + 3(last 1 followed by 3 zero's)

BGBGBB,BBGBGB,BBBGBG,GG

well logic is how hw mny jump of 1's u need to do to get it to the end of
the sequence.
GBG requires 1 iteration ie BGG

On Mon, Jun 27, 2011 at 11:27 PM, kartik sachan kartik.sac...@gmail.comwrote:

 HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS
 CASE GBGBBB

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: spoj shlights

2011-06-27 Thread vaibhav agarwal
@kartik also consider the case of  GB the answer is 1 BG. ie
trailing G's left.
BGB leading B's left hence only one G followed by B therefore only one
iteration.

try out some cases u will find hw it wrks.

On Tue, Jun 28, 2011 at 12:42 AM, vaibhav agarwal 
vibhu.bitspil...@gmail.com wrote:

 @kartik

 yup frgt to mention the last case 1 followed by zero's in that case number
 of iterations is the no. of trailing zeroes.
 GBGBBB
 will have four iterations
 101000 = 1(one zero b/w two ones) + 3(last 1 followed by 3 zero's)

 BGBGBB,BBGBGB,BBBGBG,GG

 well logic is how hw mny jump of 1's u need to do to get it to the end of
 the sequence.
 GBG requires 1 iteration ie BGG


 On Mon, Jun 27, 2011 at 11:27 PM, kartik sachan 
 kartik.sac...@gmail.comwrote:

 HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS
 CASE GBGBBB

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Anyone have The google resume book

2011-06-27 Thread radha krishnan
+1 :P

On Tue, Jun 28, 2011 at 12:27 AM, hary rathor harry.rat...@gmail.com wrote:
 very funny ! every one know this site swathi

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Jr QA Analysts || 6 + months Contract || Columbus OH || $26-30/hr on C2C all inc

2011-06-27 Thread Steven Smith
Hi,
Please find the following requirement and send me your consultant resume
with the following details.
Name:
Contact:
Current Location:
Relocation:
Rate:

Job Title :  Jr QA Analysts
Duration:6 + months Contract
Location :   Columbus OH
Rate : $26-30/hr on C2C all inc


**CANDIDATES LOCAL TO COLUMBUS ONLY**

General Summary
Under general supervision, the Quality Assurance (QA) Analyst will develop
and implement test plans, scenarios and test cases for projects of small to
medium size and low to moderate complexity to ensure that software meets
end-user requirements. Ability to perform general comparative analysis and
work within formal project management office processes.

Key Responsibilities
Develop test plans and scripts based upon documented requirements and use
cases Analyze and write defects in a clear and concise manner Assist team
members on additional tasks as required Ability to comprehend QA standards
and procedures

Qualifications
Minimum Experience / Education
Analytical thinking and problem-solving skills are required
Be flexible and able to multi-task
Insurance knowledge is a plus
A college degree and at least 4 years of related IT experience, with a
minimum of 2 years of QA experience
Minimum 1 year experience with Quality Center
Demonstrated ability to work effectively in a team environment
Prefer experience with Agile (Scrum)

Communication and Collaboration Skills
Written: Must be able to communicate effectively through e-mail and all
other written communications.
All communication related to requirements gathering is written in
non-technical format for the business partners.
Ability to communicate testing results to all individuals with varying
degrees of technical knowledge.
Oral: Communicate in a manner that demonstrates professionalism.
Active participation in project meetings is required.
Ability to communicate testing results to all individuals with varying
degrees of technical knowledge.

Technical Knowledge
Microsoft Office skills
Basic PC skills
General knowledge of defect tracking processes
Manual testing knowledge
Understanding of QA best practices
Problem Solving
Solid analytical skills necessary to identify defects and inconsistencies as
it relates to business requirements Assist in problem resolution

Must be non-smoker and willing to work in Columbus OH full time for the
duration of the project


Thanks,
Steven Smith
steven.sm...@panzersolutions.com

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



[algogeeks] SAP Project Manager || San Jose, CA || 6+ months Contract

2011-06-27 Thread Steven Smith
Hi,
Please find the following requirement and send me your consultant resume
with the following details.
Name:
Contact:
Current Location:
Relocation:
Rate:

Position :   SAP Project Manager
Location :  San Jose, CA
Duration : 6+ months Contract

*
*
*SAP PM with Finance modules experience + M+A experience. *

The right candidate for this will not be a “manufacturing” guy. A lot of the
Sr SAP PM’s are from that world. They need someone from the Financial
Services world, or maybe insurance etc. Anything but manufacturing…..

 We need a strong project manager for an MA project. SAP PjM position for
the Finance GSI Integration project. The net-net is that we need someone
with a finance or CPA background,

3 – 5 years of hands-on SAP Finance module experience, a VERY strong
communicator and lead, strong MS Project and MS Power Point skills and 5+
years of SAP Finance PM experience.  We need to get someone on-boarded as
soon as possible.


Thanks,
Steven Smith
*steven.sm...@panzersolutions.com*

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



[algogeeks] Re: NEED ALGO IN TIME 0.00

2011-06-27 Thread Dumanshu
@Rizwan:
don't u think for the counting sort part, if u use 11 int array as it
is without copying values in the main array, it would run faster? And
later on, get the sum from the two 11 int arrays like I did. Although
m using a single buffer so m getting 0.01. -http://ideone.com/lsK8n
So, by using a buffer of 512, u might b able to get a time of 0.0.
What do u think?

On Jun 27, 2:05 am, rizwan hudda rizwanhu...@gmail.com wrote:
 I am able to get this accepted with 0.00 Secondshttp://ideone.com/Eg2wZ
 But, I am using 512 KB Buffer. Not sure how I do get 0.00 with a
 smaller buffer size say 8KB





 On Sun, Jun 26, 2011 at 7:54 AM, Wladimir Tavares wladimir...@gmail.com 
 wrote:
  sometimes using global static variables may be better to use dynamic
  variables on the stack!

  Sometimes!

  Wladimir Araujo Tavares
  Federal University of Ceará

  On Sat, Jun 25, 2011 at 7:32 PM, Dumanshu duman...@gmail.com wrote:

  finally got it in 0.01 sec using all the optimizations i am aware of
  including what Wladimir had suggested.
  Now wat to do for 0.00???
  heres my code-
 http://ideone.com/lsK8n

  please suggest if any further optimizations possible.

  On Jun 26, 2:21 am, Dumanshu duman...@gmail.com wrote:
   Ok, it seems like bucket sort is the best way to do it.  I got 0.06
   and to go further weneedto use char buffer like the one Wladimir
   suggested.
   But still i have a doubt that would it be possible to reduce 0.06 to
   0.00 using that buffer?

   I don't think there can be any possible improvement in logic.
   wat do u think?

   On Jun 26, 12:25 am, Dumanshu duman...@gmail.com wrote:

see i got 0.07 sec as the time after using counting sort.. because the
hotness scale is 0-10 so i used an array of 11 ints to count the no.
of occurrences. But i m nt able to further reduce this.
ny suggestions?

theres a comment on the problem:
On an interesting side note: the maximising principle underlying this
problem generalises to almost-everywhere finite functions on sigma-
finite measure spaces by a theorem of Hardy and Littlewood, see
Theorem II.2.2 in C. Bennett, R. Sharpley, Interpolation of
Operators
ny use???

On Jun 25, 3:08 pm, prathimzn prathi...@gmail.com wrote:

 somebody answer how to reduce time
 *- - - - -
 WITH REGARDS,

 *
 *
 PRAMENDRA RATHI
 *
 **

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

 On Sat, Jun 25, 2011 at 12:27 AM, prathimzn prathi...@gmail.com
 wrote:
  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 bestalgoto solve this problem
  in 0.00
  i.e. bestalgo

  *

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

[algogeeks] novel written test

2011-06-27 Thread amit the cool
Conversation between two mathematicians: first : I have three
children. The product of their ages is 36 . If you sum their ages . it
is exactly same as my neighbor's door number on my left. The second
mathematician verifies the door number and says that the not
sufficient . Then the first says  o.k one more clue is that my
youngest is the youngest Immediately the second mathematician
answers . Can you answer the question asked by the first
mathematician? What are the children ages?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] novel written test

2011-06-27 Thread Piyush Sinha
1,6,6

On Tue, Jun 28, 2011 at 2:07 AM, amit the cool amitthecoo...@gmail.comwrote:

 Conversation between two mathematicians: first : I have three
 children. The product of their ages is 36 . If you sum their ages . it
 is exactly same as my neighbor's door number on my left. The second
 mathematician verifies the door number and says that the not
 sufficient . Then the first says  o.k one more clue is that my
 youngest is the youngest Immediately the second mathematician
 answers . Can you answer the question asked by the first
 mathematician? What are the children ages?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] novel written test

2011-06-27 Thread amit the cool
A chain is broken into three pieces of equal lengths containing 3
links each. It is taken to a back smith to join into a single
continuous one . How many links are  to be opened to make 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.



Re: [algogeeks] novel written test

2011-06-27 Thread amit kumar
@piyush..will u xplain plz.
by d way 2 sons cant hav d same age(hope they r nt twins)

On Tue, Jun 28, 2011 at 2:14 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 1,6,6


 On Tue, Jun 28, 2011 at 2:07 AM, amit the cool amitthecoo...@gmail.comwrote:

 Conversation between two mathematicians: first : I have three
 children. The product of their ages is 36 . If you sum their ages . it
 is exactly same as my neighbor's door number on my left. The second
 mathematician verifies the door number and says that the not
 sufficient . Then the first says  o.k one more clue is that my
 youngest is the youngest Immediately the second mathematician
 answers . Can you answer the question asked by the first
 mathematician? What are the children ages?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] novel written test

2011-06-27 Thread udit sharma
Since the product of their ages is 36. So the possible combination of ages
may b: either
1 4 9 or
4 3 3
6 6 1
1 2 18
1 3 12
1 1 36
2 2 9
Now neighbor's door numbr gives the sum.. Here all gives uniq sum except
(sum=13)
So there will be doubt in either 6 6 1 or 2 2 9
Bt as mathematician said tat youngest is the youngest So 1 6 6 will be d
final ans...
Correct me if m wrong.. :) :)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] novel written test

2011-06-27 Thread gmagog...@gmail.com
Is it required that no two sons have the same age?

From my view, the clue my youngest is the youngest only defines the
requirement that the youngest one is unique, but he can still have two
older brothers of the same age. Please correct me if this is wrong.

Yanan Cao



On Mon, Jun 27, 2011 at 3:54 PM, amit kumar amitthecoo...@gmail.com wrote:

 @piyush..will u xplain plz.
 by d way 2 sons cant hav d same age(hope they r nt twins)


 On Tue, Jun 28, 2011 at 2:14 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 1,6,6


 On Tue, Jun 28, 2011 at 2:07 AM, amit the cool 
 amitthecoo...@gmail.comwrote:

 Conversation between two mathematicians: first : I have three
 children. The product of their ages is 36 . If you sum their ages . it
 is exactly same as my neighbor's door number on my left. The second
 mathematician verifies the door number and says that the not
 sufficient . Then the first says  o.k one more clue is that my
 youngest is the youngest Immediately the second mathematician
 answers . Can you answer the question asked by the first
 mathematician? What are the children ages?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] novel written test

2011-06-27 Thread Piyush Sinha
We just need to look the 3 set of number that multiply to 36...

the set can be as
(1,1,36),(1,2,18),(1,4,9)..(1,6,6),(1,3,12)..(2,2,9)

The catch here is we need not find the whole set...the second mathematician
can't guess their ages through their sum that means there are at least two
possible combination that sum to the same value..

we have 1,6,6 and 2,2,9

second clue says my youngest is youngest...

if we look into the combination, we find the first set have unique age for
the youngest son..hence the ages..

and 2 sons can have same age without being twins...one born in the month of
jan and the other born in the month of december...:P :P
moreover its no where mentioned there can't be any twins

On Tue, Jun 28, 2011 at 2:24 AM, amit kumar amitthecoo...@gmail.com wrote:

 @piyush..will u xplain plz.
 by d way 2 sons cant hav d same age(hope they r nt twins)

 On Tue, Jun 28, 2011 at 2:14 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 1,6,6


 On Tue, Jun 28, 2011 at 2:07 AM, amit the cool 
 amitthecoo...@gmail.comwrote:

 Conversation between two mathematicians: first : I have three
 children. The product of their ages is 36 . If you sum their ages . it
 is exactly same as my neighbor's door number on my left. The second
 mathematician verifies the door number and says that the not
 sufficient . Then the first says  o.k one more clue is that my
 youngest is the youngest Immediately the second mathematician
 answers . Can you answer the question asked by the first
 mathematician? What are the children ages?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
*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] novel written test

2011-06-27 Thread sourabh jakhar
two

On Tue, Jun 28, 2011 at 2:23 AM, amit the cool amitthecoo...@gmail.comwrote:

 A chain is broken into three pieces of equal lengths containing 3
 links each. It is taken to a back smith to join into a single
 continuous one . How many links are  to be opened to make 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.




-- 
SOURABH JAKHAR,(CSE)(3 year)
ROOM NO 167 ,
TILAK,HOSTEL
'MNNIT ALLAHABAD

The Law of Win says, Let's not do it your way or my way; let's do it the
best way.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] novel written test

2011-06-27 Thread gmagog...@gmail.com
if( links can be melt and made into smaller links )
{
return 1;
}
else
{
return 2;
}
Yanan Cao



On Mon, Jun 27, 2011 at 4:09 PM, sourabh jakhar sourabhjak...@gmail.comwrote:

 two


 On Tue, Jun 28, 2011 at 2:23 AM, amit the cool amitthecoo...@gmail.comwrote:

 A chain is broken into three pieces of equal lengths containing 3
 links each. It is taken to a back smith to join into a single
 continuous one . How many links are  to be opened to make 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.




 --
 SOURABH JAKHAR,(CSE)(3 year)
 ROOM NO 167 ,
 TILAK,HOSTEL
 'MNNIT ALLAHABAD

 The Law of Win says, Let's not do it your way or my way; let's do it the
 best way.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] novel written test

2011-06-27 Thread amit kumar
how 2??

On Tue, Jun 28, 2011 at 2:40 AM, gmagog...@gmail.com gmagog...@gmail.comwrote:


 if( links can be melt and made into smaller links )
 {
 return 1;
 }
 else
 {
 return 2;
 }
 Yanan Cao



 On Mon, Jun 27, 2011 at 4:09 PM, sourabh jakhar 
 sourabhjak...@gmail.comwrote:

 two


 On Tue, Jun 28, 2011 at 2:23 AM, amit the cool 
 amitthecoo...@gmail.comwrote:

 A chain is broken into three pieces of equal lengths containing 3
 links each. It is taken to a back smith to join into a single
 continuous one . How many links are  to be opened to make 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.




 --
 SOURABH JAKHAR,(CSE)(3 year)
 ROOM NO 167 ,
 TILAK,HOSTEL
 'MNNIT ALLAHABAD

 The Law of Win says, Let's not do it your way or my way; let's do it the
 best way.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] novel written test

2011-06-27 Thread amit kumar
ok piyush..u r right.well done

On Tue, Jun 28, 2011 at 2:31 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 We just need to look the 3 set of number that multiply to 36...

 the set can be as
 (1,1,36),(1,2,18),(1,4,9)..(1,6,6),(1,3,12)..(2,2,9)

 The catch here is we need not find the whole set...the second mathematician
 can't guess their ages through their sum that means there are at least two
 possible combination that sum to the same value..

 we have 1,6,6 and 2,2,9

 second clue says my youngest is youngest...

 if we look into the combination, we find the first set have unique age for
 the youngest son..hence the ages..

 and 2 sons can have same age without being twins...one born in the month of
 jan and the other born in the month of december...:P :P
 moreover its no where mentioned there can't be any twins

 On Tue, Jun 28, 2011 at 2:24 AM, amit kumar amitthecoo...@gmail.comwrote:

 @piyush..will u xplain plz.
 by d way 2 sons cant hav d same age(hope they r nt twins)

 On Tue, Jun 28, 2011 at 2:14 AM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 1,6,6


 On Tue, Jun 28, 2011 at 2:07 AM, amit the cool 
 amitthecoo...@gmail.comwrote:

 Conversation between two mathematicians: first : I have three
 children. The product of their ages is 36 . If you sum their ages . it
 is exactly same as my neighbor's door number on my left. The second
 mathematician verifies the door number and says that the not
 sufficient . Then the first says  o.k one more clue is that my
 youngest is the youngest Immediately the second mathematician
 answers . Can you answer the question asked by the first
 mathematician? What are the children ages?

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
 *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-27 Thread aditya kumar
@Kamakshi.thnks.i dint realise that.
On Mon, Jun 27, 2011 at 11:04 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 @saket  - No

 O(n) + O(n/2) + O(n/4)... = O(n)

 sum of series
 n+n/2+n/4+n/8 = 2n


 On Mon, Jun 27, 2011 at 9:26 PM, Sanket vasa.san...@gmail.com wrote:

 @Dave - Wouldn't your solution also become O(kn) where k = number of
 bits in the number?
 In this summation - O(n) + O(n/2) + O(n/4) + ...= O(n) - you would
 have O(n) appearing 'k' times. Each entry is O(n/ 2^i) where 'i' is
 the bit position from right to left, starting at 0. The range of 'i'
 is from 0 to 'k-1'
 Please correct me if I am wrong.

 On Jun 27, 7:29 am, Bhavesh agrawal agr.bhav...@gmail.com wrote:
  can anyone plz post the code for this problem

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Re: O(n) Time is the problem. ..

2011-06-27 Thread Anand
http://anandtechblog.blogspot.com/2011/06/google-question-find-missing-number.html

On Mon, Jun 27, 2011 at 4:12 PM, aditya kumar
aditya.kumar130...@gmail.comwrote:


 @Kamakshi.thnks.i dint realise that.

 On Mon, Jun 27, 2011 at 11:04 PM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 @saket  - No

 O(n) + O(n/2) + O(n/4)... = O(n)

 sum of series
 n+n/2+n/4+n/8 = 2n


 On Mon, Jun 27, 2011 at 9:26 PM, Sanket vasa.san...@gmail.com wrote:

 @Dave - Wouldn't your solution also become O(kn) where k = number of
 bits in the number?
 In this summation - O(n) + O(n/2) + O(n/4) + ...= O(n) - you would
 have O(n) appearing 'k' times. Each entry is O(n/ 2^i) where 'i' is
 the bit position from right to left, starting at 0. The range of 'i'
 is from 0 to 'k-1'
 Please correct me if I am wrong.

 On Jun 27, 7:29 am, Bhavesh agrawal agr.bhav...@gmail.com wrote:
  can anyone plz post the code for this problem

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Re: Statement Riddle

2011-06-27 Thread varun pahwa
*'Ferari driver' easily beats the 'force indain driver'.* *'force indain
drive' had outdone the 'ferari driver'. Now second statement says force
indian drive outdone the ferari driver (who is a man who must have
run/walked).*

On Mon, Jun 27, 2011 at 9:09 AM, Vishal Thanki vishaltha...@gmail.comwrote:

 this may be  a reverse race, who comes last will win..

 On Mon, Jun 27, 2011 at 6:22 PM, Dave dave_and_da...@juno.com wrote:
  Force indain driver finishes second in race. Ferari was next to last.
 
  Dave
 
 
 
  On Jun 27, 2:18 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
  *Statement Riddle  - 27 june
   *
  *
  *
  **
  *'Ferari driver' easily beats the 'force indain driver' in a two care
  race.How did Indian newspapers *
  *truthfully report so to look as 'force indain drive' had outdone the
  'ferari driver'
  Think ??
  *
  *Update Your Answers at* : Click
  Here
 http://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?la...
 
  *Solution:*
  Will be updated after 1 day
 
  --
 
  Never explain yourself. Your friends don’t need it
 and
  your enemies won’t believe it .
 
  --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 

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




-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112 ,08011820777
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 using a stack

2011-06-27 Thread Ashish Goel
Hi,

The implementation is simple using 2 stacks, however we also need to make
sure that if queue length is say x, we are able to enqueue x elements. As
per my understanding, i could think of the solution using 4 stacks instead
of 2(1 for enqueue, 1 for dequeue, 1 aux for enqueue, 1 aux for dequeue) .
Is there any better approach.


Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] PUZZLE

2011-06-27 Thread Bhavesh agrawal
All the nine digits are arranged here so as to form four square numbers:

  9  81   324   576

How would you put them together so as to form  single smallest possible
square number and a single largest possible square number..



139854276 and 923187456 are the answers given everywhere but how to proceed
this ??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-27 Thread sagar pareek
It was due to finish of oxygen inside the car.as it was sealed with
closed door and windows

On Sat, Jun 25, 2011 at 8:59 PM, sarveswaran v sarveswar...@gmail.comwrote:

 she might have died because of heat generated inside the closed car

 On Jun 24, 3:05 am, 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
 http://dailybrainteaser.blogspot.com/2011/06/sherlock-puzzle.html?lav...
 
  --
 
  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.




-- 
*Regards
Sagar Pareek
M.Tech cse (pur.)
Motilal Nehru National Institute Of Technology (MN 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.



[algogeeks] Re: PUZZLE

2011-06-27 Thread Dave
@Bhavesh: Check the squares of the integers from
ceiling(sqrt(123456789)) to floor(sqrt(987654321)) to see which ones
contain all nine nonzero digits. Since the sum of the nine nonzero
digits is 45, a satisfactory square will be a multiple of 9, and
therefore, we only need consider the squares of integers that are
multiples of 3. Something like this should do the trick:

int i, j, k;
for( i = 2 ; i  31426 ; i += 3 )
{
j = i * i;
k = 0;
do
{
k |= 1  (j % 10);
j /= 10;
} while( j  0 );
if( k = 0x3FE )// 11  1110 in binary.
printf(%i\n,i);
}

Dave

On Jun 27, 11:01 pm, Bhavesh agrawal agr.bhav...@gmail.com wrote:
 All the nine digits are arranged here so as to form four square numbers:

           9      81       324       576

 How would you put them together so as to form  single smallest possible
 square number and a single largest possible square number..

 139854276 and 923187456 are the answers given everywhere but how to proceed
 this ??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: PUZZLE

2011-06-27 Thread Dave
Replying to myself, I should have printed i*i instead of i near the
end of the code:
printf(%i\n,i*i);

Dave

On Jun 27, 11:47 pm, Dave dave_and_da...@juno.com wrote:
 @Bhavesh: Check the squares of the integers from
 ceiling(sqrt(123456789)) to floor(sqrt(987654321)) to see which ones
 contain all nine nonzero digits. Since the sum of the nine nonzero
 digits is 45, a satisfactory square will be a multiple of 9, and
 therefore, we only need consider the squares of integers that are
 multiples of 3. Something like this should do the trick:

 int i, j, k;
 for( i = 2 ; i  31426 ; i += 3 )
 {
     j = i * i;
     k = 0;
     do
     {
         k |= 1  (j % 10);
         j /= 10;
     } while( j  0 );
     if( k = 0x3FE )            // 11  1110 in binary.
         printf(%i\n,i);
 }

 Dave

 On Jun 27, 11:01 pm, Bhavesh agrawal agr.bhav...@gmail.com wrote:



  All the nine digits are arranged here so as to form four square numbers:

            9      81       324       576

  How would you put them together so as to form  single smallest possible
  square number and a single largest possible square number..

  139854276 and 923187456 are the answers given everywhere but how to proceed
  this ??- 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.



  1   2   >