Re: [algogeeks] Re: Printing random word from file

2012-08-20 Thread Dave
@Navin: Okay. Here is a paraphrase. Assume double function random() returns 
a uniformly distributed random number = 0.0 and  1.0.
 
read first word from file into string save;
int i = 1
while not EOF
{
read next word from file into string temp;
i++;
if( i * random()  1.0 )
copy temp to save;
}
print save;
 
Dave

On Monday, August 20, 2012 12:02:54 AM UTC-5, Navin Kumar wrote:

 @Dave sir, I didn't get your logic. Can you please elaborate it? 

 On Sun, Aug 19, 2012 at 4:08 AM, Dave dave_an...@juno.com 
 javascript:wrote:

 @Navin: Here is the algorithm:
  
 Save the first word. 
 For i = 2, 3, ..., n = number of words in the file
 replace the saved word with the i-th word with probability 1/i.
 When EOF is reached, every word in the file will have probability 1/n of 
 being the saved word. Print it.
  
 Dave

 On Saturday, August 18, 2012 1:28:56 AM UTC-5, Navin Kumar wrote:

 Print a *Random word* from a file. Input is path to a file, 

 constraints- No extra memory like hashing etc. All the words in the file 
 should have equal probability.

  -- 
 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/-/HxO-wNzEP9gJ.

 To post to this group, send email to algo...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 algogeeks+...@googlegroups.com javascript:.
 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 view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/crET-x06vpkJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] direct i online round

2012-08-20 Thread mohit choudhary
Scan first array check repeated values as in example( rt_triangle(4, {0,
-1, -1, 1}, {1, -2, 1, -2}))
-1,-1 is repeated twice at  indices in array respectively 1and 2.
now in second y-axis array check values at indices given by first array (in
above example these values are -2 and 1 respectively)
check for repetition  of these values in second array and for each repition
increment the count .in example -2 and 1 both are repeated so count becomes
2.
return count.
for this example answer is 2.

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

2012-08-20 Thread rizwan hudda
@sai ram: Logic is NOT fine. That is the first thing you should accept.
You need to design an efficient solution to run in the required time limit.
I think the
time limit for this problems allows only O(n* log n) solutions to be
accepted and your
solution is slower than that.

On Fri, Aug 17, 2012 at 11:19 PM, apoorv gupta apoorvcool2...@gmail.comwrote:

 Time limit xcded..i figured iut logic ts just a version of insertion
 sort.. but i thnk some other algo will do d work here,


 On Fri, Aug 17, 2012 at 3:32 PM, Sairam Ravu ravu...@gmail.com wrote:

 The problem for me is in the run time - logic is fine, but why is it
 not running in the given time.






 --
 With love and regards,
 Sairam Ravu
 I M.Tech(CS)
 Sri Sathya Sai Institute of Higher Learning
 To live life, you must think it, measure it, experiment with it,
 dance it, paint it, draw it, and calculate 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.




 --
 *
 
 Thanks And Sincere Regards
 Apoorv Gupta
 Btech Final Year
 Computer Science And Engineering
 MNNIT Allahabad
 *

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




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

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

2012-08-20 Thread vipul jain
In there exam dey will ask 20 question on apti and one or two lago's will
be der.
last time they didn't checked the algo part becoz they dnt knw the answer
of that
then 2 intervw and after that telephonic intervw

On Sun, Aug 19, 2012 at 10:46 AM, Arun Kindra arunkin...@gmail.com wrote:

 Can anyone know Indus Valley Partners Paper Pattern and ques?



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




-- 
Thanks  Regards
Vipul Jain

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

2012-08-20 Thread Arun Kindra
Is it for campus recruitment process or Off campus?
And can u specify the Apti topic, and is there any analytical reasoning?
If possible plz share Coding ques.

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



Re: [algogeeks] O(n) solution is there or not!!

2012-08-20 Thread Carl Barton
Yeah sorry, misread the question then had a quick attempt :) I don't see
where you get the lg n from though. I didn't do any binary searches.

On 19 August 2012 22:53, pankajsingh psingh...@gmail.com wrote:

 @carl- got ur point..but complexity is more..suffix array  takes
 o(n^2lgn)..considering string comparisons. complexity to build...i already
 have o(n^2)..want o(n)..

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


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



Re: [algogeeks] O(n) solution is there or not!!

2012-08-20 Thread pankajsingh
Thanks.carl and atul.!!.@carl-i got lgn due to string comparison sort while
making the suffix array..:)

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

2012-08-20 Thread vipul jain
yar i forgot those coding question
and there were 20 question and covering each and every topic of apti
but u shud score 18 out of it becoz simole hote h vo

On Mon, Aug 20, 2012 at 7:37 PM, Arun Kindra arunkin...@gmail.com wrote:

 Is it for campus recruitment process or Off campus?
 And can u specify the Apti topic, and is there any analytical reasoning?
 If possible plz share Coding ques.

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




-- 
Thanks  Regards
Vipul Jain
lVth yr
Information Technology
Nit Jaipur

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



Re: [algogeeks] O(n) solution is there or not!!

2012-08-20 Thread Carl Barton
I still don't understand. There's far quicker suffix array construction
algorithms than O(n^2 log n)? There's O(n) algorithms

On 20 August 2012 23:27, pankajsingh psingh...@gmail.com wrote:

 Thanks.carl and atul.!!.@carl-i got lgn due to string comparison sort
 while making the suffix array..:)

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