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

Method merge

publication/code/chapter07/tim_sort_without_gallop.rs:193–206  ·  view source on GitHub ↗

归并排序

(&mut self)

Source from the content-addressed store, hash-verified

191
192 // 归并排序
193 fn merge(&mut self) {
194 while self.second_pos > self.dest_pos && self.second_pos < self.list_len {
195 debug_assert!(self.first_pos + (self.second_pos - self.first_len) == self.dest_pos);
196
197 if self.temp[self.first_pos] > self.list[self.second_pos] {
198 self.list[self.dest_pos] = self.list[self.second_pos];
199 self.second_pos += 1;
200 } else {
201 self.list[self.dest_pos] = self.temp[self.first_pos];
202 self.first_pos += 1;
203 }
204 self.dest_pos += 1;
205 }
206 }
207}
208
209impl<'a> Drop for MergeLo<'a> {

Callers 2

merge_loFunction · 0.45
merge_hiFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected