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

Method swim

src/common/priority_queue.rs:100–105  ·  view source on GitHub ↗
(&mut self, mut k: usize)

Source from the content-addressed store, hash-verified

98 }
99
100 fn swim(&mut self, mut k: usize) {
101 while k > 1 && self.compare(k / 2, k) {
102 self.pq.swap(k, k / 2);
103 k /= 2;
104 }
105 }
106
107 fn sink(&mut self, mut k: usize) {
108 let n = self.n;

Callers 2

enqueueMethod · 0.80
decrease_keyMethod · 0.80

Calls 2

compareMethod · 0.80
exchMethod · 0.80

Tested by

no test coverage detected