發表文章

目前顯示的是 11月 13, 2018的文章

Yet Another MinHeap

圖片
up vote 9 down vote favorite 1 So, this has been done quite a few times on here, but each of the linked implementations has some significant issues. Since I needed a MinHeap anyway, I figured I would throw my version into the ring. In my case, I'm working on a toy game prototype where the simulation runs a clock that keeps track of the time in-game, and I have callbacks that I want to run at a particular game time, so the callbacks go into a priority queue and each time the simulation clock ticks up, I execute all of the callbacks that are before the new in-game time. Previous Comments First off, to address some comments on other implementations that I don't agree with: If this is in production code you should consider using SortedSet SortedSet<T> has a much more general API, and I'm not at all sure...