Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QMHTMY/RustBook
/ build_add
Method
build_add
code/chapter07/binary_heap.rs:59–63 ·
view source on GitHub ↗
切片数据逐个加入堆
(&mut self, arr: &[i32])
Source
from the content-addressed store, hash-verified
57
58
// 切片数据逐个加入堆
59
fn build_add(&mut self, arr: &[i32]) {
60
for &val in arr {
61
self.push(val);
62
}
63
}
64
65
// 末尾添加一个数据,调整堆
66
fn push(&mut self, val: i32) {
Callers
1
main
Function · 0.45
Calls
1
push
Method · 0.45
Tested by
no test coverage detected