back to eggert home
back to home
assign 5
out of all the assignments, this one is probably done the best
that's not a high bar to clear though tbh
tips?
since it's already so clear, i'll just give some implementation tips
-
a cool toposort impl for a problem can be found
here
-
i also found
an alternate impl
by gfg if you like that site more
-
holy crap i just found
this mega based standard library
ig you have to read a bit of documentation to figure it out but once you have that down
you don't have to touch any icky algorithms
-
make sure to only output commits reachable from the branch heads!
i spent ages malding over why my code was failing one of the tcs only to realize it was this
-
besides the libraries they already gave, i found `pathlib` and `collections` to be quite helpful
you might not have use for these libraries, though, and that's ok!
-
the spec says to use `strace -f` to make sure you don't call any system processes,
but it doesn't tell you what to look for
so once you have the outputted file, just `grep` for `execve` in the resulting logs;
there should be only calls to `python` or whatever (at least i think so?)
what to turn in
`topo_order_commits.py`, which should contain a function `topo_order_commits` that runs
everything as well as comments explaining your approach to the problem
don't be like me and have the script run only when directly executed
basically the file you turn in should be exactly the one that passes the pytest suite they gave
`topo-test.tr.gz`, gen'd by running this in the test suite:
```bash
strace -f -o topo-test.tr pytest
gzip -9 topo-test.tr
```