[−][src]Function tao_of_rust::ch02::collections::binary_heap
pub fn binary_heap()
优先队列:BinaryHeap
Basic usage:
use std::collections::BinaryHeap; fn binary_heap() { let mut heap = BinaryHeap::new(); assert_eq!(heap.peek(), None); heap.push(93); heap.push(80); heap.push(48); heap.push(53); heap.push(72); heap.push(30); heap.push(18); heap.push(36); heap.push(15); heap.push(35); heap.push(45); assert_eq!(heap.peek(), Some(&93)); println!("{:?}", heap); // [93, 80, 48, 53, 72, 30, 18, 36, 15, 35, 45] } binary_heap();Run