Skip to content

Instantly share code, notes, and snippets.

@arkology
arkology / PriorityQueueDEPQ.gd
Last active March 24, 2025 23:10
Double-ended priority queue implementation for Godot using GDScript
extends Reference
class_name PriorityQueueDEPQ
# Double-ended priority queue using standart array and standart custom_sort() function
# It can be very slow if constantly toogle _unsorted flag, but almost as fast as heap if used correctly
# Try to awoid getting queue values such as min/max value/priority after queue modification
# Wrong way to use:
# add("element0", 0)
# pop_min()