Slightly optimized priority queue. Now I use value "undefined" to release the memory allocated by the dequeue element. Earlier I used the default value I received when allocating an array. It is probably the same value.