Timeline for Make Depth First Search program more time efficient
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 10, 2020 at 13:24 | history | edited | CommunityBot |
Commonmark migration
|
|
Jul 22, 2019 at 8:36 | comment | added | eric.m |
Just as an extra note, since you are not really interested on how the list is represented internally, it might be better to declare them as List instead of ArrayList e.g. private List<Node> , private List<Integer> etc
|
|
May 7, 2016 at 13:58 | history | bounty ended | CommunityBot | ||
May 5, 2016 at 20:02 | history | edited | Emily L. | CC BY-SA 3.0 |
Fixing for changes in original question.
|
May 5, 2016 at 19:46 | history | edited | Emily L. | CC BY-SA 3.0 |
Fixed issue with BFS
|
May 5, 2016 at 19:36 | history | edited | Emily L. | CC BY-SA 3.0 |
Adding suggestions for improving adjacency lists.
|
May 4, 2016 at 22:06 | comment | added | Pieter Witvoet |
Making dfs iterative is relevant for another reason as well: the website that hosts this challenge contains a test-case that pretty much guarantees a stack-overflow.
|
|
May 4, 2016 at 11:15 | comment | added | Clearer | As I said, my experience is not mainly in Java but in other languages. If it's easy to get rid of the recursion (especially if someone has already provided a solution for you), you should ofc just do it; it's a free optimization which doesn't depend on the compiler -- even if it's slight. Even with recursive functions which the compiler cannot optimize away, my experience is that it makes little difference if the implementation is manually optimized away. As always, it depends highly on the compiler (and flags) and the particular implementation in question. | |
May 4, 2016 at 10:42 | comment | added | Emily L. | @Clearer when the compiler can eliminate the recursion through Tail Call Optimization or when the work performed in the function body is large compared to function call overhead then you are correct but in this case I believe that neither of those are true. | |
May 4, 2016 at 10:38 | history | edited | Emily L. | CC BY-SA 3.0 |
Must be queue for bfs
|
May 4, 2016 at 10:33 | comment | added | Clearer | While function call overhead can lead to significant performance drops, I find that it usually it's not worth the effort to get rid of recursive functions; my experience is not main java, though, and here things may be different (experienced comments welcome). | |
May 4, 2016 at 10:21 | history | answered | Emily L. | CC BY-SA 3.0 |