priority queue:功能性的面向数据的优先级队列不会吸引 源码
优先队列 功能性的,面向数据的优先级队列,不会吸引 Web上有许多优先级队列实现,但是我找不到满足以下条件的任何优先级队列: 在运行时不分配内存 有测试 是功能性的,面向数据的 很小! (〜150行代码) 是一个纯ES模块 所以我们到了! 用法 import PQ from 'priority-queue' // declarea a custom function for comparing the priority values of 2 items in the queue function comparator ( a , b ) { return a < b ? true : false } // create a new priority queue that can hold a maximum of 20,000 items. // by default max
下载地址
用户评论