[algogeeks] Re: [brain teaser ] TRICK BRAIN TEASER 2 May

2011-05-03 Thread RAghu
silly but nice one On May 2, 10:22 pm, neha lawaria lawaria...@gmail.com wrote: F On Mon, May 2, 2011 at 1:17 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: * TRICK BRAIN TEASER  S E Q U E N C _ What letter can you place on the line, other than E, to complete this sequence? *

[algogeeks] Re: Divisibility by five

2011-05-03 Thread RAghu
http://www.ken.duisenberg.com/potw/archive/arch05/050608sol.html On May 3, 9:25 am, Dave dave_and_da...@juno.com wrote: Given an integer n, give an O(log n) algorithm to determine if n is divisible by 5 without using division or mod. -- You received this message because you are subscribed to

[algogeeks] Re: Divisibility by five

2011-05-03 Thread abhishekriyer
A naive method would be repeated subtraction which is division. So subtract the number repeatedly by 5 unless the value that remains is less than 0. If its 0 then the number is divisible by 5 On May 3, 9:25 am, Dave dave_and_da...@juno.com wrote: Given an integer n, give an O(log n) algorithm to

Re: [algogeeks] Re: Divisibility by five

2011-05-03 Thread ps.raghuchan...@gmail.com
Given it should be of O(log(n)). On Tue, May 3, 2011 at 12:48 PM, abhishekriyer abhishekr.iye...@gmail.comwrote: A naive method would be repeated subtraction which is division. So subtract the number repeatedly by 5 unless the value that remains is less than 0. If its 0 then the number is

[algogeeks] Re: Divisibility by five

2011-05-03 Thread anshu
algorithm: if any number(a) is divisible by 5 it can be wriiten as 4*b + b -- this cleary shows the last two bit of a b will be same. lets understand by an example (35)10 = (100011)2 xx1100 + xx11 - 100011 now this clearly shows we can calculate the unknowns(x) by traversing right

[algogeeks] Re: Need the algorithm or idea

2011-05-03 Thread bittu
in hurryi will suggest you to study TRIE in Detail as Much as you can..Then you will not only get the idea but also you will able to implement see practical uses of Trie in computer Science Thanks Regards Shashank Mani -- You received this message because you are subscribed to the

Re: [algogeeks] Re: Divisibility by five

2011-05-03 Thread ADITYA KUMAR
awesome solution On Tue, May 3, 2011 at 1:43 PM, anshu anshumishra6...@gmail.com wrote: algorithm: if any number(a) is divisible by 5 it can be wriiten as 4*b + b -- this cleary shows the last two bit of a b will be same. lets understand by an example (35)10 = (100011)2 xx1100 +

[algogeeks] Efficient Way to Detect Duplicate Document

2011-05-03 Thread bittu
suppose You have a billion urls, where each is a huge page. How do you detect the duplicate documents? on what criteria you will detect it, what algorithm , approach , whats will be the complexity of each approach as it has many application in computer science ...i would like to have some good

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-05-03 Thread Logic King
What about the people explaining the answer above as '12'saying processing will start from left in cout and write in printf ?? On Sun, May 1, 2011 at 1:33 AM, Amit Jaspal amitjaspal...@gmail.com wrote: This is compiler dependent..and not a portable way of writing code On Sat,

Re: [algogeeks] Re: Need the algorithm or idea

2011-05-03 Thread Anand
You can use edit distance to find out how close is your given word with words present in the dictionary. I could not think of anything in O(n). http://anandtechblog.blogspot.com/2010/08/edit-distance-algorithm.html On Tue, May 3, 2011 at 7:27 AM, bittu shashank7andr...@gmail.com wrote: in

[algogeeks] Re: A SIMPLE C++ PROGRAM.

2011-05-03 Thread Don
The code is undefined, meaning that a valid compiler can produce any result that it wants. Multiple side effects between sequence points are not defined. It would be perfectly acceptable for a valid compiler to shoot flying monkeys out of your monitor. And it would serve you right for writing such

[algogeeks] Re: TRICK BRAIN TEASER - MAN ALIVE 3 may

2011-05-03 Thread Dave
The ice was poisoned. He drank the punch early, before enough ice melted to result in a fatal dose. Dave On May 3, 2:40 am, Lavesh Rawat lavesh.ra...@gmail.com wrote: *TRICK BRAIN TEASER MAN ALIVE  * * * ** *A man went to a party and drank some of the punch. He then left early. Everyone

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

2011-05-03 Thread Ashish
Hi, Could you pls email this book to me :ashish...@gmail.com? Regards, Ashish -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Re: Divisibility by five

2011-05-03 Thread Dave
@anshu: Spoiler alert... I was thinking of something more along the line int DivisibleBy5 (int n) { n = n 0 ? n : -n; while( n 0 ) n = (n 2) - (n 3); return (n == 0); } To see that it works, write n as n = 4*a + b, where 0 = b = 3. Then the iteration replaces n by a - b.

Re: [algogeeks] Need the algorithm or idea

2011-05-03 Thread Sathaiah Dontula
is it not EDIT DISTANCE (DP) problem ? Thanks regards, Sathaiah Dontula On Tue, May 3, 2011 at 9:03 AM, lichenga2404 lichenga2...@gmail.com wrote: The question in an interview. And I got lost with this one. Could you guys give some algorithm or idea on this ? Write a program that reads

Re: [algogeeks] Divisibility by five

2011-05-03 Thread Umer Farooq
public static isDivisibleByFive(int input) { String str_input = String.valueof(input); // convert initial int to string. if ((str_input.charat(str_input.length()-1) == '5') || (str_input.charat(str_input.length()-1) == '0') // check if the last character is 0 or 5 return true; return false; }

Re: [algogeeks] Need the algorithm or idea

2011-05-03 Thread Umer Farooq
I have got a solution for this problem but It is greater than O(n^2). The idea is to take the edit distance with selected words from dictionary of all words in english and output the word with min edit distance (An edit distance is number of insertions, deletions and replacement operations needed

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

2011-05-03 Thread venkat kumar
sir, kindly send me the link too. thank you On Fri, Apr 29, 2011 at 9:35 PM, Umer Farooq the.um...@gmail.com wrote: please send it to me at the.um...@gmail.com Thanks in advance :) On Sat, Apr 30, 2011 at 8:41 AM, Manish Kumar manish.iitia...@gmail.comwrote: please send me this book

Re: [algogeeks] If anyone have this book please mail me Thanks in advance

2011-05-03 Thread Priyanka Chatterjee
Yes please delete the links and stop asking for books which are not free On 30 April 2011 21:24, Varun Nagpal varun.nagp...@gmail.com wrote: Please refrain from sharing such links and engaging in piracy. I kindly request the admin of this forum to delete all such posts and to warn the users