Re: [algogeeks] DLL to B-tree
I was asked this question at Microsoft. so take the given node and check the following to detect if it is a DLL or BTree if (node-pointer1-pointer2 != node){ its a BTree }else { DLL } now converting to the other is a big problem in itself Thanks, On Mon, Aug 9, 2010 at 8:04 PM, amit amitjaspal...@gmail.com wrote: Given a pointer to the node, the node has one data part and two address pointers of its own type, If the node represent a doubly linked list convert it to B-Tree and vice versa. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] XAndOr
Hi all , Any optimal solution for this problem ,Any help would be appreciated.. http://www.codechef.com/problems/INSOMA5/ Regards, bonami -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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] Maximum size binary search tree
@ above ur soln ll fail in situation like 10 / \ 15 18 /\ / \ 22 7 17 77 the inorder is 22 15 7 10 17 18 77 so the longest increasing sequence is 7-77 but this is not a bst as 10 n 7 r nt connected On 24 June 2010 22:36, gopinath sikha gopisi...@gmail.com wrote: We can find the solution in O(n) where n is number of nodes. Do an in-order traversal of the binary tree. then scan through the numbers and find the list and find the longest(increasing or decreasing) sequence. That is the size of maximum size of BST in the given binary tree. On Wed, Jun 23, 2010 at 11:40 AM, Raj N rajn...@gmail.com wrote: Find the maximum size Binary search tree in a binary tree?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- -- If u doubt your believes,u believe ur doubts If u fail to practise,u practises failure Thanks and Regards GopiNath -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] minimum window containing charecters
@ Anand, No , It doesnt Try with String2 = LH String1 = HELLO. I think LCS solves a different problem from the one being asked here. I think we must generate all possible combination of strings and for each combination , check if all chars from str2 is present in it. On Sun, Aug 1, 2010 at 11:54 PM, Anand anandut2...@gmail.com wrote: Even if they are not in the same order still it works http://codepad.org/jpCUqwpA http://codepad.org/jpCUqwpA On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47 AM, Anand anandut2...@gmail.com wrote: Using Dynamic programing(Longest common subsequence logic) we can solve this problem in O(nm) where n is the length of the first string and m is the length of second string. Last element of matrix which the length of the string that matches. http://codepad.org/cyiKEMSF http://codepad.org/cyiKEMSF On Sun, Aug 1, 2010 at 8:13 AM, srikanth sg srikanthini...@gmail.comwrote: plz .. if any one knows dp solution then tell ... On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor ashimkap...@gmail.comwrote: I am not sure, but can I do this using a suffix trie ? any comments ? On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.com wrote: solution could be to find the charcter position from both sides for each char of s2 then from the 2*n array, find the smallest index from left and largest from right, within these two indexes all chars would be there one case where one of the chars can be missing can be found if a row in this 2-d array remains unmodified Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, Jul 31, 2010 at 10:22 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote: At the moment, I can only think of an O(n^3) algo. Maybe if you can find a hash function which computes the hash value depending on the unique characters the string contains, you can reduce it to O(n^2). On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.com wrote: given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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
Re: [algogeeks] minimum window containing charecters
all the solutions mentioned above are not complete 1)need to solve this problem with sliding window concept 2)its O(n) On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase harishp...@gmail.com wrote: @ Anand, No , It doesnt Try with String2 = LH String1 = HELLO. I think LCS solves a different problem from the one being asked here. I think we must generate all possible combination of strings and for each combination , check if all chars from str2 is present in it. On Sun, Aug 1, 2010 at 11:54 PM, Anand anandut2...@gmail.com wrote: Even if they are not in the same order still it works http://codepad.org/jpCUqwpA http://codepad.org/jpCUqwpA On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47 AM, Anand anandut2...@gmail.com wrote: Using Dynamic programing(Longest common subsequence logic) we can solve this problem in O(nm) where n is the length of the first string and m is the length of second string. Last element of matrix which the length of the string that matches. http://codepad.org/cyiKEMSF http://codepad.org/cyiKEMSF On Sun, Aug 1, 2010 at 8:13 AM, srikanth sg srikanthini...@gmail.comwrote: plz .. if any one knows dp solution then tell ... On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor ashimkap...@gmail.comwrote: I am not sure, but can I do this using a suffix trie ? any comments ? On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.comwrote: solution could be to find the charcter position from both sides for each char of s2 then from the 2*n array, find the smallest index from left and largest from right, within these two indexes all chars would be there one case where one of the chars can be missing can be found if a row in this 2-d array remains unmodified Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, Jul 31, 2010 at 10:22 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote: At the moment, I can only think of an O(n^3) algo. Maybe if you can find a hash function which computes the hash value depending on the unique characters the string contains, you can reduce it to O(n^2). On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.com wrote: given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit
[algogeeks] Re: Median of two arrays..
is there any time complexity? the also can be like this char *res; char *ptr1 =arr1; char *ptr2 =arr2; int count =0, n= len(arr1) ,m=len(arr2); while(1){ while(*ptr1 *ptr2){ ptr2++; count ++; if( count == (n+m)/2 ){ res=ptr1; break out of outer while loop; } } while(*ptr1 *ptr2){ ptr1++; count ++; if( count == (n+m)/2 ){ res=ptr2; break out of outer while loop; } } } On Aug 6, 7:20 pm, Manjunath Manohar manjunath.n...@gmail.com wrote: will this work in two sorted arrays of equal length.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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] closest pair problem
Hi, Can someone give me the code for finding closest pair of points using divide and conquer strategy? Thanks !! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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] P ! = NP
http://www.telegraph.co.uk/science/science-news/7938238/Computer-scientist-Vinay-Deolalikar-claims-to-have-solved-maths-riddle-of-P-vs-NP.html Check out this cool news. Kishen -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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: minimum window containing charecters
Take two variables leftMost and rightMost, for each char in string 2 if index of char form string 2 in string 1 leftMost, leftMost - index if index of char from string 2 in string 1 rightMost, rightMost - index else continue with for loop in the end, the difference between rightMost and leftMost (right-left) should be the max window size required. Since a window isn't being used, the order anyways doesn't matter. For example S1- H E L L O S2 LH left = length, right = 0 index of L in S1 is 2, which is left and right so left = right = 2 index of H in S1 is 0, which is left but not right, so now left = 0, right = 2, width = right - left+1 = 3 which is right since the window will be HEL -Minotauraus. On Jul 31, 6:39 am, srikanth sg srikanthini...@gmail.com wrote: given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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] closest pair problem
hi, I feel we have discussed the solution to this problem using DP.ts in archives.pls check it On Wed, Aug 11, 2010 at 11:17 PM, Raj N rajn...@gmail.com wrote: Hi, Can someone give me the code for finding closest pair of points using divide and conquer strategy? Thanks !! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 algoge...@googlegroups.com. To unsubscribe from 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] minimum window containing charecters
@all:u need to calculate the hash value of very substring(no other go since the letters are in different order we ought to do it).then apply Rain Karp algorithm. On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase harishp...@gmail.com wrote: @ Anand, No , It doesnt Try with String2 = LH String1 = HELLO. I think LCS solves a different problem from the one being asked here. I think we must generate all possible combination of strings and for each combination , check if all chars from str2 is present in it. On Sun, Aug 1, 2010 at 11:54 PM, Anand anandut2...@gmail.com wrote: Even if they are not in the same order still it works http://codepad.org/jpCUqwpA http://codepad.org/jpCUqwpA On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47 AM, Anand anandut2...@gmail.com wrote: Using Dynamic programing(Longest common subsequence logic) we can solve this problem in O(nm) where n is the length of the first string and m is the length of second string. Last element of matrix which the length of the string that matches. http://codepad.org/cyiKEMSF http://codepad.org/cyiKEMSF On Sun, Aug 1, 2010 at 8:13 AM, srikanth sg srikanthini...@gmail.comwrote: plz .. if any one knows dp solution then tell ... On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor ashimkap...@gmail.comwrote: I am not sure, but can I do this using a suffix trie ? any comments ? On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.comwrote: solution could be to find the charcter position from both sides for each char of s2 then from the 2*n array, find the smallest index from left and largest from right, within these two indexes all chars would be there one case where one of the chars can be missing can be found if a row in this 2-d array remains unmodified Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, Jul 31, 2010 at 10:22 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote: At the moment, I can only think of an O(n^3) algo. Maybe if you can find a hash function which computes the hash value depending on the unique characters the string contains, you can reduce it to O(n^2). On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.com wrote: given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to
Re: [algogeeks] P ! = NP
Yeah,,,...lets hope the next turing goes to this Indian. Its still being verified. On Thu, Aug 12, 2010 at 12:54 AM, Kishen Das kishen@gmail.com wrote: http://www.telegraph.co.uk/science/science-news/7938238/Computer-scientist-Vinay-Deolalikar-claims-to-have-solved-maths-riddle-of-P-vs-NP.html Check out this cool news. Kishen -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] P ! = NP
Thats the scary part. Some MIT Professor has announced additional 200 thousand dollars, if the proof is correct. He will surely get a turing, if the proof is correct. Will be second Indian after Raj Reddy to achieve this. Kishen On Wed, Aug 11, 2010 at 7:58 PM, Varun Nagpal varun.nagp...@gmail.comwrote: Yeah,,,...lets hope the next turing goes to this Indian. Its still being verified. On Thu, Aug 12, 2010 at 12:54 AM, Kishen Das kishen@gmail.com wrote: http://www.telegraph.co.uk/science/science-news/7938238/Computer-scientist-Vinay-Deolalikar-claims-to-have-solved-maths-riddle-of-P-vs-NP.html Check out this cool news. Kishen -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: P ! = NP
We are proud that an Indian has attempted to solve this problem. Avik -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.