Skip to content

DFS pizza slicing algorithm

lyashenkogs edited this page Jan 27, 2017 · 2 revisions

DFS algorithm adaptation

According to the last one discussion, the most efficient algorithm for the pizza task is the Deep first search with some customizations. Instead of a graph, we have a 2D array. Instead of nodes - "steps". See also traversing graphs visualization Step as an entity is an amount of a pizza cells, that can be added to a slice of a pizza or a pizza cell. Step as an action is a process of

  • adding cells to a start cell or a start slice
  • validate generated slice according to the pizza slicing instructions
  • if validation passed -> cutting the start cell with added cells from the pizza

Diagrams on the draw.io