49 add union find data structure#62
Conversation
…tor implementation
…concerns and notes in a comment
…t for subsets to HashMap
… mismatches that will be sorted out later on if I decide to stick with HashMaps
…by size in UnsortedUnionFind
…w private method contains(T e)
…ure maps fulfil set requirement
…) as static method problematic due to variable type
…ionFind; adapt interfaces accordingly
…by size in SortedUnionFindTest
… in SortedUnionFind
… and commented out debug output (designed together with c-m-elliott in a meeting)
… helper methods to ParentPointerTree
…red helper methods to ParentPointerTree; return type of getAllSubsets() may need to be changed in the future
|
@baierd could you please take a look at ParentPointerTreeUnionFind? It uses ParentPointerTree and TreeNode which both don't implement any standard interfaces at the moment. For example, TreeNode could implement Object and ParentPointerTree could have Collection. They would mean quite a few additional methods which I don't need for the union-find. I am wondering whether they might be valuable further down the line (in case of potential future uses) or just add bulk without real benefit. What do you think? |
That would make no sense. Every concrete instance of a class is automatically a object.
Do you really want to implement everything from You don't need to implement a interface if they are not helpful. |
|
Thanks, then I will leave them as they are. I don't see myself needing Collection features with what I have planned at the moment. |
So far, this includes the interfaces UnionFind, SortedUnionFind, PersistentUnionFind and PersistentSortedUnionFind as well as the abstract classes AbstractImmutableUnionFind and AbstractImmutableSortedUnionFind. It also contains a naive implementation of SortedUnionFind based on a HashMap of TreeSets (SortedTreeSetUnionFind). There is a set of tests (SortedUnionFindTest), but there seems to be some kind of problem regarding null values which is causing the JDK21 PackageSanityTest to fail. This in particular is something I'd appreciate input on. Thanks!