Re: [algogeeks] Duplicate file in all computers in a network
start with N bytes.. because each computer is connected to every other computer transfer 1st byte to computer 1 transfer 2nd byte to computer 2 transfer 3rd byte to computer 3 transfer 4th byte to computer 4 . . . transfer N byte to computer N now computer 2 can open say x port and read 1st,3rd,4th,5th...xth byte from computer 1,computer 3,computer 4,computer 5,...computer x.. similarly other can do. On Wed, Aug 22, 2012 at 2:04 PM, Karthikeyan V.B kartmu...@gmail.comwrote: A network of N computers is such that each computer is connected to every other.Transferring one byte of information between two computers takes one unit of time. In the beginning, a file resides on only one computer on the network. The size of the file is M bytes. Come up with a strategy to duplicate this file across all N machines {that is each machine should have a local copy of the file} in minimum amount of time. -- 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.
[algogeeks] Re: INTERFACES VS ABSTRACT
Java does not implement multiple inheritance. Interfaces are a way to have an Object having multiple behaviors. Abstract class won't give you that facility. Moreover, Interfaces should be used only to define types (Refer Effective Java by Josh Bloch for discussion on Abstract classes vs Interfaces) On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- 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/-/D52I5Y6cYTcJ. 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.
[algogeeks] Re: INTERFACES VS ABSTRACT
Dear sulekha, when u want a default property to get embedded ie u want to force any feature use abstract. when u want an additional feature need to be added used interface. ex: For a car the default things are steering, engine, etc... if u want the car to compulsory to have A/c then add it in the abstract for a car having ABS is optional include it as an interface where ever u think its necessary. On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- 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/-/qI3YhsGoh7wJ. 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.
[algogeeks] Re: MS interview
Dear GC, The efficient data structure in my opinion is Hash Table. 1. For a given word in the dictionary we need to form an anagram dictionary i.e. take a given word sort it which forms the key for the hashtable , then start forming the different anagrams for that word and insert it into the hash table with the corresponding key. 2. Once the hash table is ready for the given word sort it find the key and print all the anagarams i.e. values associated to that key. we will get all the anagrams for a given word. Coming to time complexity... sorting of a word can be done in a O(nlogn). building of anagram will take O(n). hash complexity O(n) worst case. so total time complexity is O(nlogn) for whole execrcise. Thanks Bhargava On Wednesday, 22 August 2012 23:39:02 UTC+5:30, GC wrote: Ques.. Given a m-word dictionary ... and a n-sized word... .. now suggest DS for dictionary such that you can find out all the anagrams of the given word present in dictionary... -- Regards, G C -- 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/-/ySPUSvS0Sh0J. 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: INTERFACES VS ABSTRACT
With an abstract class, the subclass of that inheritance tree only can and should provide the definitions of the methods. With an interface, subclasses of different inheritance tree can also implement the same methods. Interface provides a way to separate out and group common behavior of different inheritance trees. It is kind of a substitute for the multiple inheritance that some other languages provide. On Thu, Aug 23, 2012 at 4:59 PM, kings dns.bhar...@gmail.com wrote: Dear sulekha, when u want a default property to get embedded ie u want to force any feature use abstract. when u want an additional feature need to be added used interface. ex: For a car the default things are steering, engine, etc... if u want the car to compulsory to have A/c then add it in the abstract for a car having ABS is optional include it as an interface where ever u think its necessary. On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- 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/-/qI3YhsGoh7wJ. 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: INTERFACES VS ABSTRACT
Abstract class are used for Abstraction Interface are used for Polymorphism On Thu, Aug 23, 2012 at 6:06 PM, Amit Tiwari amit.monu...@gmail.com wrote: With an abstract class, the subclass of that inheritance tree only can and should provide the definitions of the methods. With an interface, subclasses of different inheritance tree can also implement the same methods. Interface provides a way to separate out and group common behavior of different inheritance trees. It is kind of a substitute for the multiple inheritance that some other languages provide. On Thu, Aug 23, 2012 at 4:59 PM, kings dns.bhar...@gmail.com wrote: Dear sulekha, when u want a default property to get embedded ie u want to force any feature use abstract. when u want an additional feature need to be added used interface. ex: For a car the default things are steering, engine, etc... if u want the car to compulsory to have A/c then add it in the abstract for a car having ABS is optional include it as an interface where ever u think its necessary. On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- 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/-/qI3YhsGoh7wJ. 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. -- best wishes!! Vaibhav -- 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: MS interview
yes, that is correct. O(mn) to form multimap and then O(m) to tell all anagram groups Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Aug 23, 2012 at 5:11 PM, kings dns.bhar...@gmail.com wrote: Dear GC, The efficient data structure in my opinion is Hash Table. 1. For a given word in the dictionary we need to form an anagram dictionary i.e. take a given word sort it which forms the key for the hashtable , then start forming the different anagrams for that word and insert it into the hash table with the corresponding key. 2. Once the hash table is ready for the given word sort it find the key and print all the anagarams i.e. values associated to that key. we will get all the anagrams for a given word. Coming to time complexity... sorting of a word can be done in a O(nlogn). building of anagram will take O(n). hash complexity O(n) worst case. so total time complexity is O(nlogn) for whole execrcise. Thanks Bhargava On Wednesday, 22 August 2012 23:39:02 UTC+5:30, GC wrote: Ques.. Given a m-word dictionary ... and a n-sized word... .. now suggest DS for dictionary such that you can find out all the anagrams of the given word present in dictionary... -- Regards, G C -- 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/-/ySPUSvS0Sh0J. 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: MS interview
i would suggest using tires data structure, basically a n-nary tree to store the dictionary. Entire algo is as follows: 1) Create a trie http://en.wikipedia.org/wiki/Trie representing the dictionary. 2) create a aux array for the search key. as count [ key[i] ] ++; 3) Start a recursion from the root of the trie and pick a path if (count [ path ] 0 ) 3rd step ensures that we traverse only those valid paths (ie valid words, this would reduce n! checking of all combinations). On Thu, Aug 23, 2012 at 8:23 PM, Ashish Goel ashg...@gmail.com wrote: yes, that is correct. O(mn) to form multimap and then O(m) to tell all anagram groups Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Aug 23, 2012 at 5:11 PM, kings dns.bhar...@gmail.com wrote: Dear GC, The efficient data structure in my opinion is Hash Table. 1. For a given word in the dictionary we need to form an anagram dictionary i.e. take a given word sort it which forms the key for the hashtable , then start forming the different anagrams for that word and insert it into the hash table with the corresponding key. 2. Once the hash table is ready for the given word sort it find the key and print all the anagarams i.e. values associated to that key. we will get all the anagrams for a given word. Coming to time complexity... sorting of a word can be done in a O(nlogn). building of anagram will take O(n). hash complexity O(n) worst case. so total time complexity is O(nlogn) for whole execrcise. Thanks Bhargava On Wednesday, 22 August 2012 23:39:02 UTC+5:30, GC wrote: Ques.. Given a m-word dictionary ... and a n-sized word... .. now suggest DS for dictionary such that you can find out all the anagrams of the given word present in dictionary... -- Regards, G C -- 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/-/ySPUSvS0Sh0J. 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.