Rearrangements

2 problems from Rosalind — Bioinformatics Stronghold. Press Run on any block to execute it in your browser.

REAR — Reversal Distance

solved Problem statement

Where BA6C's 2-break distance had a closed form, this has none at size 10 and must be searched: 45 reversals per step, 3.6 million reachable orders, distance reaching 9. The builtin searches from both ends and meets in the middle, so each side only reaches depth 4 or 5.

SORT — Sorting by Reversals

solved Problem statement

REAR asks how far apart two gene orders are; this asks for the route, which is what actually says how the rearrangement happened. The assertion applies the reversals and checks they produce the target — a plausible list that does not sort is the failure this invites.