MCPcopy Create free account
hub / github.com/douchuan/algorithm / insert

Function insert

tests/test_common_heap.rs:76–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74
75#[test]
76fn insert() {
77 //normal
78 let t = vec![4, 1, 3, 2, 16, 9, 10, 14, 8, 7];
79 let mut heap = max_heap::BinaryHeap::new(t);
80 // data layout:
81 // vec![16, 14, 10, 8, 7, 9, 3, 2, 4, 1];
82 heap.insert(100);
83 let data = heap.keys_slice();
84 assert_eq!(data, vec![100, 16, 10, 8, 14, 9, 3, 2, 4, 1, 7])
85}

Callers

nothing calls this directly

Calls 2

keys_sliceMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected