コード例 #1
0
ファイル: PriorityQueue.cs プロジェクト: Zerryth/algos
        public int Enqueue(object value, int priority)
        {
            var newNode = new PriorityNode(value, priority);

            Values.Add(newNode);
            return(BubbleUp(Values.Count - 1));
        }
コード例 #2
0
ファイル: PriorityQueue.cs プロジェクト: Zerryth/algos
 /// The smaller the priority value, the greater the priority.
 private bool IsGreaterPriorityThanParent(int index, PriorityNode parent) => Values[index].Priority < parent.Priority;