Unable to load image

Day 12

Post code, nerds.

14
Jump in the discussion.

No email address required.

>be me :marseydoctor:

>C++chad :gigachad:

>see routing problem A→B

>decide to implementmaxx A* :marseybigbrain:

>???

>spend 1 hour to find the proper C++® STL™ way to implement a min heap :marseyreading:

>SEGFAULTmaxxing :marseybsod:

>spend 1 hour GDBmaxxing :marseytrollgun::marseytrollgun::marseytrollgun:

>mixed up two C++® iterators™, calling close.erase(in_open_it) in place of close.erase(in_close_it) :marseyrope:

>itworks.mp4

>PART B

>???

>FIND ALL PATHS FROM THE END TO ALL POINTS AT ELEVATION ZERO :marseytrollcrazy::marseytrollgun::marseytrollcrazy::marseytrollgun:

>I SHOULD HAVE IMPLEMENTED DIJKSTRA

:#marseyraging::#marseyraging::#marseyraging::#marseyraging:

@everyone snakes @drama_enthusiast discuss

![](/images/16708629914528806.webp)

Jump in the discussion.

No email address required.

spend 1 hour to find the proper C++® STL™ way to implement a min heap

isnt it just a std::unordered_queue?

Jump in the discussion.

No email address required.

Yes but you can't search and erase an arbitrary element from it. At the end of the day I used the make_heap on a vector, complexity is the same


Well you don't need to necessarily erase it but you have to be able to change its priority when A* finds a better path

Jump in the discussion.

No email address required.

Not sure why would want that feature? The idea would be to write a comparator/less function that ensure that the element with the lowest edge weight + heuristic is always at the front.

Jump in the discussion.

No email address required.

Yes. If you have in the open set a vertex x with f(x) = 50, and A* finds another vertex from which f(x) = 40 you have to update the open set with the new f

Jump in the discussion.

No email address required.

GOLDEN BSOD

:#!marseysoypoint::#marseygolden2::#marseysoypoint:

@SlidingDonGER schizocel discuss

Jump in the discussion.

No email address required.

GOLDEN BSOD

I see, future Microsoft dev in the working

:marseysmug3: :marseybsod:

Jump in the discussion.

No email address required.

The challenges are already too much for me to enjoy them, im sry c++ chad , but i can only say that the code seems nice.

Jump in the discussion.

No email address required.

Fair enough

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.