[algogeeks] string

2010-07-18 Thread Ratnesh Thakur
Given a string A, and a string B, and a dictionary, how would you convert A to B in the minimum no of operations, given that: i) All the intermediate words must be from the dictionary ii) An ‘operation’ is defined as: a) Delete any character from a string ex dog → do b) Insert any character

Re: [algogeeks] Re: graph

2010-07-18 Thread jalaj jaiswal
can be done in O(n^2) also below is a rough pseudocode initialize visited[v]=0 for every vertex v{ call dfs(v) check if al visited are 1 or not if all visited break; else do visited[v]=0 again. } correcf me if i'm missing anything On Fri, Jul 16, 2010 at 5:38 AM, Gene

Re: [algogeeks] a google question

2010-07-18 Thread Ashish Goel
question please... Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Fri, Jul 16, 2010 at 4:43 PM, manish bhatia mb_mani...@yahoo.com wrote: It doesn't work A = 92 87 81 72 70 61 53 22 18 17 B = 79 78 74 68 64 62 57 34 29 24 C (GOLD) =

Re: [algogeeks] string

2010-07-18 Thread Ashish Goel
http://en.wikipedia.org/wiki/Levenshtein_distance Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sun, Jul 18, 2010 at 6:08 PM, Ratnesh Thakur ratneshthaku...@gmail.comwrote: Given a string A, and a string B, and a dictionary, how would you

Re: [algogeeks] Re: graph

2010-07-18 Thread Ratnesh Thakur
@jalaj..he has asked for a linear algo On Sat, Jul 17, 2010 at 12:47 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: can be done in O(n^2) also below is a rough pseudocode initialize visited[v]=0 for every vertex v{ call dfs(v) check if al visited are 1 or not if all

[algogeeks] Re: GIven 2 dates, print out the lines in the file between these 2 dates. Also optimize solution because the file may be huge and so dont go line by line.

2010-07-18 Thread Snoopy Me
At the time of logging, the timestamp can be added to a B-tree, with the nodes having the line number(i.e., number of bytes to be skipped from the beginning). At the time of searching, simple logarithmic time search will directly return the line address. On Jul 17, 11:27 pm, vijay

[algogeeks] Adobe Puzzle

2010-07-18 Thread amit
Puzzle, A square Island surrounded by bigger square, and in between there is infinite depth water. The distance between them is L. The wooden blocks of L are given. The L length block can't be placed in between to cross it, as it will fall in water (just fitting). How would you cross using these L

[algogeeks] Boxes!!!

2010-07-18 Thread amit
Given a lot of cuboid boxes with different length, breadth and height. We need to find the maximum subset which can fit into each other. For example: If Box 1 has LBH as 7 8 9 If Box 2 has LBH as 5 6 8 If Box 3 has LBH as 5 8 7 If Box 4 has LBH as 4 4 4 then answer is 1,2,4 A box can fit into

Re: [algogeeks] Dynamic Programming Problem on Strings

2010-07-18 Thread Amir hossein Shahriari
@ashish: AAA is the prefix of the string and it is valid as a prefix and it's only used for strings with length = 6 (where it is a valid prefix) actually only dp[i][j] where i==j counts the number of such strings and otherwise there is no string where i!=j and it that case dp[i][j] counts the

Re: [algogeeks] Adobe Puzzle

2010-07-18 Thread erappy
Use the block of size L, use the diagonal of the block (diagonal would be definitely L ) to fit in between two square islands. Thanks, On Sun, Jul 18, 2010 at 11:38 PM, amit amitjaspal...@gmail.com wrote: Puzzle, A square Island surrounded by bigger square, and in between there is infinite

Re: [algogeeks] a google question

2010-07-18 Thread 王奇凡
@Kushwaha Your programe is wrong. Try this input: a[ ] = {30,25,19,16,14}; b[ ] = {20,18,12,10,8}; the right answer should be 50 48 45 43 42 but the program output is 50 48 45 43 37。 2010/5/2 Jitendra Kushwaha jitendra.th...@gmail.com Here is a solution of O(n) , taking 4 pointers 2 for