Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. CO@ Steven Hood : This is a similar solution to @Zim-Zam O'Pootertoot 's solution (which is essentially ALGORITHM_2). I understand that both solutions will be equally applicable to the application domain (based on his answer and description of the underlying data structures of TreeMap in Java), so your answer is also applicable to my question (but of a duplicate nature). I believe that keeping track of the `temp` variable as paths are found is more efficient and easier to implement, especially if one does not understand Maps very well (my friend, for example). Thank you for your input :)
      singulars
    2. CORight, I'm additionally suggesting that (assuming it isn't required) you don't track the resultant paths, since it isn't strictly necessary to find even the shortest `N` (where `N << M*M`) paths.
      singulars
    3. COIf I understand you correctly, we don't need to keep track of 'duplicate' paths, which include reverse iterations of the initial paths that we track. For example... and I'm sorry for the unwanted formatting in comments... if we had the data set `0, 1, 2, 3, 4, 0`m then `0, 4, 3, 2, 1, 0` would ALSO be a duplicate entry, that of course, has the exact same 'shortest path' value. This is why I said our algorithm would NOT be conforming to the 'hopeful' (n-1)!/2 number of results. It is sad, but I don't have enough time or experience to code something that checks for duplicates and skips... =/
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload