Skip to content

Commit 7039aad

Browse files
committed
(comment) day15: note about refactoring to use a priority queue
1 parent 80b9bcc commit 7039aad

File tree

1 file changed

+3
-0
lines changed
  • day15/src/main/kotlin/org/adventofcode

1 file changed

+3
-0
lines changed

day15/src/main/kotlin/org/adventofcode/App.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ object PathFinder {
103103
val destinationPoint = grid.lastPoint
104104
val initTraversalEntry = TraversalEntry()
105105
val traversedEntries = mutableMapOf(ORIGIN_POINT to initTraversalEntry)
106+
// N.B. Probably should refactor open entries to be a priority queue to
107+
// get O(logn) insert and remove versus sorting that cost O(nlogn). Makes
108+
// a significant difference in performance for very large grids
106109
val openEntries = mutableListOf(ORIGIN_POINT to initTraversalEntry)
107110

108111
while (openEntries.isNotEmpty()) {

0 commit comments

Comments
 (0)