Get those avacados
mkdir build
cd build
cmake ..
make -j12
Optionally running individual test binary:
../build/test/tests
unfortunately you need to run tests from test directory. I didn't spend enough time to set resource dir for tests
- The first thing came to mind was to solve using BFS to walk to closest
neighbor till we collect all avacados. This is implemented in
shortest_path.cpp
. Time complexity of this would be(num_of_avacados+1) * O(mn + m*n!)
wherem = # of rows
andn = # of cols
- Second thing I wanted to try to create highly connected graph
using important nodes (start and avacado nodes) and then narrow it down to variant of
Travelling Salesman Problem. I solved second part of this using modified Dijkstra and bitmask.
This is implemented in
shortest_path_astar.cpp
which usesA*.cpp
to create graph that I described before. I don't think this is efficient approach - it would be very slow as nodes increased - as it has exponential complexity. - I should have started out with namespace, but I didn't and never got around creating later on. So you might see some alias duplicated. :-/