Re: [algogeeks] Re: Saving and restoring Binary trees in files
1) save the nodes(value, left and right pointer) in pre-order traversal 2) also save pointers of all node in same order to restore 1) create new N nodes 2) do pointer mapping from old - new 3) restore nodes and replace old pointers to new On Fri, Nov 8, 2013 at 8:50 PM, Don dondod...@gmail.com wrote: Save it in pre-order. Rebuild by inserting nodes in the order they occur in the file. On Friday, November 8, 2013 8:33:19 AM UTC-5, kumar raja wrote: What is the effective way to save and restore the binary trees to files effectively? Regards, Kumar Raja. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- Thanks, Vishnu -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
Re: [algogeeks] os ques about paging
3584 On Sun, Sep 25, 2011 at 9:53 AM, sivaviknesh s sivavikne...@gmail.comwrote: Consider a virtual memory system in which the virtual page addresses are mapped onto physical page addresses as follow Virtual page address.. Physical page address 03 12 2...1 The address of any byte in this system is given by the ordered pair (v,d) where v = virtual page address d = byte offset in the page Assuming that the main memory is capable of holding 4 page frames, what is the physical address of a byte having the virtual address (0,512) given that the page size is 1024 bytes? a) 3584 b) 2560 c) 1536 d) 512 e) 1024 -- Regards, $iva -- 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. -- ~VISHNU~ -- 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] Amazon question SDE
This can be done using binary indexed tree. Thanks and Regards, Vishnu Vardan Reddy Onteddu Software Engineer KeyPoint Technologies India Pvt Ltd. 9Q1A, 9th Floor, Cyber Towers, HITEC City, Madhapur, Hyderabad – 500081. T: +91 40 40337000 Extn 70__ F: +91 40 40337070 www.keypoint-tech.com Be Impressed Try it for Yourself www.adaptxt.com ENGAGING CAPABILITY www.adaptxt.com Registered Address: 123/3RT, SR Nagar, Hyderabad-500038, India. © KeyPoint Technologies UK. All rights reserved. This email plus any attachments is strictly private and confidential. Disclosure, copying, or use, fully or partially is not permitted. Precautions against known computer viruses are attempted. We accept no responsibility / liability for damage or consequences caused by viruses or from unauthorised / unagreed changes. If received mistakenly, inform sender and destroy this email entirely. On Tue, Sep 20, 2011 at 3:28 PM, saurabh agrawal saurabh...@gmail.comwrote: Design an algorithm to perform operation on an array Add(i,y)- add value y to i position sum(i) - sum of first i numbers we can use additional array O(n) and worst case performance should be O(log n) for both operation -- 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] main function
Output will be 5 4 3 2 1 as static variable will be initialized only once. -- 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] Java DataStructure advice needed - Need to compare large and adhoc files (the files may have 1 milliion rows)
Need to compare large and adhoc files (the files may have 1 milliion rows) in java. So need to load these files in a datastructure and based on a set of rules , need to realign and compare these rows. Can you advice which datastructure/Collection class is best fit. Or anyway I need to custom code to optmize the performance of the datastructure without causing system memory issues. -- 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: Need to compare large and adhoc files in Java
Cant see my mail going out On Fri, Jun 10, 2011 at 12:26 AM, vishnu madiga vishnu.mad...@gmail.comwrote: Need to compare large and adhoc files (the files may have 1 milliion rows) in java. So need to load these files in a datastructure and based on a set of rules , need to realign and compare these rows. Can you advice which datastructure/Collection class is best fit. Or anyway I need to custom code to optmize the performance of the datastructure without causing system memory issues. -- 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: challenging problem , looking for a quick and a best algorithm
Generally we will have random set of credits and debits (which can have many to many matchings). We need to find a match such that we are left with minimum possible credit/debit which is unmatched. On Tue, Jun 7, 2011 at 11:09 PM, vishnu madiga vishnu.mad...@gmail.comwrote: find a combination of credits and debits which will sum out to zero in a given set of credit and debit values. It's not necessary to have a one to one match between a debit and credit. For example, the parent may lend $25 and $75 to its subsidiary and receive back 3 payments of $20, $40 and $40. The task is to match these entries in an account. This becomes taxing because multiple debits can be applied to multiple credits. In many cases there is more than one way to match the values. The goal is to develop a solution which will take a set of credits and debits and match as many debits to as many credits as possible. A test case could have up to 2,000 debits and credits. -- 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] challenging problem , looking for a quick and a best algorithm
Good suggestion Navneet.. I had a similar solution but am looking for something more faster. Performance is a major consideration to me. The possible permutations for a large set of debits and credits could be massive. The solution should be intelligent enough to discard non-possible branches quickly. On Tue, Jun 7, 2011 at 11:15 PM, Navneet Gupta navneetn...@gmail.comwrote: Well, one approach is have all possible sums stored for debits and credits and match the sums. Basically, you can create a multi-list type DS (if i remember the name correctly) and store the SUMS and with formative elements in linked lists being pointer by node containing sums SUM 1 - Header 1 - Header 2 - Header 3 Header1 - Debit m - Debit n (Here one of the possibilities of forming a sum SUM 1 is Debit m + Debit n) Now, it's basically a design choice whether you want to have a single DS like above to contain both Credit and Debit based calculations or have separate multi-lists for Debits and Credits. On Tue, Jun 7, 2011 at 7:39 PM, vishnu madiga vishnu.mad...@gmail.com wrote: find a combination of credits and debits which will sum out to zero in a given set of credit and debit values. It's not necessary to have a one to one match between a debit and credit. For example, the parent may lend $25 and $75 to its subsidiary and receive back 3 payments of $20, $40 and $40. The task is to match these entries in an account. This becomes taxing because multiple debits can be applied to multiple credits. In many cases there is more than one way to match the values. The goal is to develop a solution which will take a set of credits and debits and match as many debits to as many credits as possible. A test case could have up to 2,000 debits and credits. -- 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. -- --Navneet -- 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] challenging problem , looking for a quick and a best algorithm
Frns, Any more tries / suggestions? On Tue, Jun 7, 2011 at 11:26 PM, vishnu madiga vishnu.mad...@gmail.comwrote: Good suggestion Navneet.. I had a similar solution but am looking for something more faster. Performance is a major consideration to me. The possible permutations for a large set of debits and credits could be massive. The solution should be intelligent enough to discard non-possible branches quickly. On Tue, Jun 7, 2011 at 11:15 PM, Navneet Gupta navneetn...@gmail.comwrote: Well, one approach is have all possible sums stored for debits and credits and match the sums. Basically, you can create a multi-list type DS (if i remember the name correctly) and store the SUMS and with formative elements in linked lists being pointer by node containing sums SUM 1 - Header 1 - Header 2 - Header 3 Header1 - Debit m - Debit n (Here one of the possibilities of forming a sum SUM 1 is Debit m + Debit n) Now, it's basically a design choice whether you want to have a single DS like above to contain both Credit and Debit based calculations or have separate multi-lists for Debits and Credits. On Tue, Jun 7, 2011 at 7:39 PM, vishnu madiga vishnu.mad...@gmail.com wrote: find a combination of credits and debits which will sum out to zero in a given set of credit and debit values. It's not necessary to have a one to one match between a debit and credit. For example, the parent may lend $25 and $75 to its subsidiary and receive back 3 payments of $20, $40 and $40. The task is to match these entries in an account. This becomes taxing because multiple debits can be applied to multiple credits. In many cases there is more than one way to match the values. The goal is to develop a solution which will take a set of credits and debits and match as many debits to as many credits as possible. A test case could have up to 2,000 debits and credits. -- 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. -- --Navneet -- 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.