Skip to content

Commit d352abc

Browse files
committed
Revert "Sort t's to front"
This reverts commit f31bb6b.
1 parent f31bb6b commit d352abc

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/day23.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use core::str;
2-
use std::cmp::Ordering;
32

43
use aoc_runner_derive::aoc;
54
use bitvec::array::BitArray;
@@ -104,17 +103,7 @@ pub fn part2(s: &str) -> &'static str {
104103
}
105104
}
106105

107-
vertecies.sort_unstable_by(|a, b| {
108-
if (a.0 / 26) as u8 + b'a' == b't' && (b.0 / 26) as u8 + b'a' == b't' {
109-
b.1.cmp(&a.1)
110-
} else if (a.0 / 26) as u8 + b'a' == b't' {
111-
Ordering::Less
112-
} else if (b.0 / 26) as u8 + b'a' == b't' {
113-
Ordering::Greater
114-
} else {
115-
b.1.cmp(&a.1)
116-
}
117-
});
106+
vertecies.sort_unstable_by(|a, b| b.1.cmp(&a.1));
118107
let mut i = vertecies.len() - 1;
119108
while vertecies[i].1 == 0 {
120109
i -= 1;
@@ -152,6 +141,7 @@ pub fn part2(s: &str) -> &'static str {
152141
}
153142
}
154143

144+
// Using this algorithm: https://web.archive.org/web/20160911054636/http://www.dcs.gla.ac.uk/~pat/jchoco/clique/indSetMachrahanish/papers/tomita2003.pdf
155145
fn expand(
156146
mut r: &mut [(u16, u16)],
157147
g: &BitArray<[u64; BAL]>,

0 commit comments

Comments
 (0)