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

Method push

publication/code/chapter08/binary_heap.rs:62–66  ·  view source on GitHub ↗

末尾添加一个数据,调整堆

(&mut self, val: i32)

Source from the content-addressed store, hash-verified

60
61 // 末尾添加一个数据,调整堆
62 fn push(&mut self, val: i32) {
63 self.data.push(val);
64 self.size += 1;
65 self.move_up(self.size);
66 }
67
68 // 构建新堆
69 fn build_new(&mut self, arr: &[i32]) {

Callers 6

build_addMethod · 0.45
build_newMethod · 0.45
mainFunction · 0.45
iterMethod · 0.45
iter_mutMethod · 0.45
nextMethod · 0.45

Calls 1

move_upMethod · 0.45

Tested by

no test coverage detected