()
| 164 | } |
| 165 | |
| 166 | fn main() { |
| 167 | let mut bh = BinaryHeap::new(); |
| 168 | let nums = [-1,0,2,3,4]; |
| 169 | bh.push(10); bh.push(9); |
| 170 | bh.push(8); bh.push(7); bh.push(6); |
| 171 | |
| 172 | bh.build_add(&nums); |
| 173 | println!("empty: {:?}", bh.is_empty()); |
| 174 | println!("min: {:?}", bh.min()); |
| 175 | println!("pop min: {:?}", bh.pop()); |
| 176 | |
| 177 | bh.build_new(&nums); |
| 178 | println!("size: {:?}", bh.len()); |
| 179 | println!("pop min: {:?}", bh.pop()); |
| 180 | } |