...
This recursion is accomplished using a priority queue and two functions: bfsRecursion
which recurses in a normal way and bfsRecursionToNextData
which recurses until it finds the next node with data then stops. The following table describes the conditions for recursing through the tree by bfsRecursion
. This table is based on the following three criteria: whether the node has data, whether the search query matches the node, and whether the end of the search query has been reached (ex. only typing “CS 12“ and reaching the “2“ node). In the table I call these data, match, and last respectively. Based on these criteria we do any or multiple of a few things: queue all children nodes for bfsRecursion
, queue all children nodes for bfsRecursionToNextData
, and/or return the data of the node to the suggestion results. In the table I call these bfsRecursion
, queue to next, and return data.
...