Re: [algogeeks] MS Question
Let a color below represent a single character in UTF-8 encoding , which means that each color can span multiple bytes , In example below I denote one byte by one english character . i.e. 'a' or 'b' or 'c' ,etc. below takes one byte : Let the string is : x abc def gh ij klmn now to reverse this UTF-8 encoded string in place in two steps : 1) reverse bytes of a multibyte character in place , after this step the string will look like : x cba fed hg ji nmlk 2) Now apply a normal string reversal algo , i.e , to swap first byte with last byte , swap second byte to second last byte .. and so on ... after this step the string will look like : klmn ij gh def abc x And look we have reversed an UTF-8 encoded string in place :) On Fri, Jan 13, 2012 at 11:13 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Hi Normal string will not work I think. Because it is avriable length encoding scheme. On Fri, Jan 13, 2012 at 11:11 AM, b.kisha...@gmail.com b.kisha...@gmail.com wrote: Is there anything called in-place reversal ?? UTF-8 is only encoding similar to ASCII but with a huge charecter set. So normal string reversal would work fine.. On Thu, Jan 12, 2012 at 2:02 AM, Ankur Garg ankurga...@gmail.com wrote: How to do this Write a function to reverse a UTF-8 encoded string in-place ?? -- 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. -- U -- 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: MICROSOFT
@Dave: Thanks for pointing that out . In that case , if tree is really big and we want to *save memory* : *Algorithm #1 :* 1) Convert tree to a linked list ( Right rotation or left rotation ) : O(n) 2) Quick Select Kth largest element : Worst case O(n^2) ( when tree was already a bst + if we chose pivot to be fist node of linked list everytime) 3) apply second phase of DSW algorithm to recreate the tree. O(n) Time : O(n^2) Space: O(1) Bonus : After fist call tree is perfectly balanced If tree is small , we want to *save run time* : *Algorithm #2 :* 1) Traverse tree , store elements in array : O(n) 2) Quick Select Kth largest element : O(n) Time : O(n) Space : O(n) On Thu, Sep 8, 2011 at 8:58 AM, Dave dave_and_da...@juno.com wrote: @Himanshu: You apparently are assuming that the data is presented in a binary search tree, but the original problem stated that the data is presented in an unordered array. You need to account for the complexity of forming the bst and how much space it will take. Dave On Sep 7, 7:20 pm, Himanshu Neema potential.himansh...@gmail.com wrote: Do reverse inorder and count number of nodes visited, Kth visited node will be Kth largest. Time : O(n) Space : O(1) On Mon, Sep 5, 2011 at 5:16 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: @monish: u'rs is correct , time =O(nlogn) Ok but, the constant behind this prog is very huge .. for every number coming in , u maintain minheap and maxheap,and also if the sizes are of mismatch , u delete from minheap and add that to max heap--- here deletion--O(logn),addition--O(logn),this occurs on an average for every 3 elements ... On Mon, Sep 5, 2011 at 2:08 AM, sachin goyal monugoya...@gmail.com wrote: @anup,@sukran ithink u both are right in case of binary search tree... we can traverse and then easily find the value... but in case of heap first we have to create the heap and accordingly apply the algo the create min heap. it will be the complex program so simple is bst just traverse by inorder and compare if anyone has simple solution or any other case then plz tell. On Sun, Sep 4, 2011 at 9:56 PM, monish001 monish.gup...@gmail.com wrote: ALGO: 1. For each element 1 to k: insert in into min-heap 2. for each element k+1 to n delete the root of min-heap and insert this item into the min- heap 3. Finally you have a min-heap of k largest numbers and the root is your answer COMPLEXITY: O(n logn) -Monish On Sep 3, 3:03 pm, teja bala pawanjalsa.t...@gmail.com wrote: //Asked in MS please help me with the coding or Give an algorithm Write code to return the kth largest element in a tree ... function prototype is int fucnkth(node *root,int k) -- 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. -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumar http://www.google.com/profiles/bagana.bharatkumar * Mobile +91 8056127652* bagana.bharatku...@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.- 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] Re: MICROSOFT
Do reverse inorder and count number of nodes visited, Kth visited node will be Kth largest. Time : O(n) Space : O(1) On Mon, Sep 5, 2011 at 5:16 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: @monish: u'rs is correct , time =O(nlogn) Ok but, the constant behind this prog is very huge .. for every number coming in , u maintain minheap and maxheap,and also if the sizes are of mismatch , u delete from minheap and add that to max heap--- here deletion--O(logn),addition--O(logn),this occurs on an average for every 3 elements ... On Mon, Sep 5, 2011 at 2:08 AM, sachin goyal monugoya...@gmail.comwrote: @anup,@sukran ithink u both are right in case of binary search tree... we can traverse and then easily find the value... but in case of heap first we have to create the heap and accordingly apply the algo the create min heap. it will be the complex program so simple is bst just traverse by inorder and compare if anyone has simple solution or any other case then plz tell. On Sun, Sep 4, 2011 at 9:56 PM, monish001 monish.gup...@gmail.comwrote: ALGO: 1. For each element 1 to k: insert in into min-heap 2. for each element k+1 to n delete the root of min-heap and insert this item into the min- heap 3. Finally you have a min-heap of k largest numbers and the root is your answer COMPLEXITY: O(n logn) -Monish On Sep 3, 3:03 pm, teja bala pawanjalsa.t...@gmail.com wrote: //Asked in MS please help me with the coding or Give an algorithm Write code to return the kth largest element in a tree ... function prototype is int fucnkth(node *root,int k) -- 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. -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar * Mobile +91 8056127652* bagana.bharatku...@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] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...
Hi All , Yesterday I received an email from Author that this is *violation of Intellectual Property Ownership* ,So kindly please delete pdfs please remove all the sharing. Thanks Guys. Himanshu On Thu, Apr 14, 2011 at 10:52 AM, Harshal hc4...@gmail.com wrote: Thanks :) On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar rajeevprasa...@gmail.comwrote: check this link: https://docs.google.com/viewer?a=vpid=explorerchrome=truesrcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3hl=en If you have any problem in access,please inform me On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami zeal.gosw...@gmail.com wrote: Hi, I tried to open this book in google docs and got message that file is not avaliable. does this file not available in google docs if yes , can anybody share this book again On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema potential.himansh...@gmail.com wrote: Turns out that I cant send file larger than 4 MB , please download it from here , let me know if you're still unable to download: http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf have fun ! On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema potential.himansh...@gmail.com wrote: Enjoy :) On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T mail2sarava...@gmail.com wrote: ++ On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.com wrote: and me too :) On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra mishra00...@gmail.com wrote: count me too On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav kunal.shrivas...@gmail.com wrote: plz send it to me too On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR deok...@gmail.com wrote: -- *With Regards Deoki Nandan Vishwakarma IITR MCA Mathematics Department * -- 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. -- thezeitgeistmovement.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. -- Regards Anurag Atri -- 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. -- Thank You Rajeev Kumar -- 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. -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. People die young because god loves them so much, I am still on earth because there is a goddess here who loves me even more. -- You received this message because you are subscribed
Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...
Turns out that I cant send file larger than 4 MB , please download it from here , let me know if you're still unable to download: http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf have fun ! On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema potential.himansh...@gmail.com wrote: Enjoy :) On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T mail2sarava...@gmail.comwrote: ++ On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.comwrote: and me too :) On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra mishra00...@gmail.comwrote: count me too On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav kunal.shrivas...@gmail.com wrote: plz send it to me too On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR deok...@gmail.com wrote: -- *With Regards Deoki Nandan Vishwakarma IITR MCA Mathematics Department * -- 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. -- thezeitgeistmovement.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. -- Regards Anurag Atri -- 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.
Fwd: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...
-- Forwarded message -- From: Himanshu Neema potential.himansh...@gmail.com Date: Tue, Mar 22, 2011 at 11:13 PM Subject: Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ... To: Abhishek Goswami zeal.gosw...@gmail.com Its a 15.4MB pdf so would take time to download if you have slow internet connection , otherwise i checked the link its working. But I have also uploaded it on Google docs as Abhishek suggested here : https://docs.google.com/viewer?a=vpid=explorerchrome=truesrcid=0B--bA2TobuKZNGU5Njk5OTctZWEyYi00NWMwLTk0OGItMzhkMTI1ZTk0Mjg2hl=enauthkey=CL_1msUI On Tue, Mar 22, 2011 at 11:01 PM, Abhishek Goswami zeal.gosw...@gmail.comwrote: can you upload this file into google docs or attach this file. i tried to download this file but did not get any success for open this file Thanks Abhishek On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema potential.himansh...@gmail.com wrote: Turns out that I cant send file larger than 4 MB , please download it from here , let me know if you're still unable to download: http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf have fun ! On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema potential.himansh...@gmail.com wrote: Enjoy :) On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T mail2sarava...@gmail.comwrote: ++ On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.comwrote: and me too :) On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra mishra00...@gmail.comwrote: count me too On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav kunal.shrivas...@gmail.com wrote: plz send it to me too On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR deok...@gmail.com wrote: -- *With Regards Deoki Nandan Vishwakarma IITR MCA Mathematics Department * -- 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. -- thezeitgeistmovement.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. -- Regards Anurag Atri -- 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.