MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / build_add

Method build_add

publication/code/chapter08/binary_heap.rs:55–59  ·  view source on GitHub ↗

切片数据逐个加入堆

(&mut self, arr: &[i32])

Source from the content-addressed store, hash-verified

53
54 // 切片数据逐个加入堆
55 fn build_add(&mut self, arr: &[i32]) {
56 for &val in arr {
57 self.push(val);
58 }
59 }
60
61 // 末尾添加一个数据,调整堆
62 fn push(&mut self, val: i32) {

Callers 1

mainFunction · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected