int main() { Solution s; std::vector<int> preorder{1,2,4,5,3,6}; std::vector<int> inorder{4,2,5,1,3,6}; print_bfs(s.buildTree(preorder, inorder)); }
int main(int argc, char** argv) { // parse command line options Options options = get_options(argc, argv); // build graph from data file Graph* graph = read_graph(options.filename); // validate vertex ids now that we know graph size validate_vertex_ids(options, graph->n); // branch to relevant function depending on execution mode switch (options.part) { case PRINT_DFS: print_dfs(graph, options.source); break; case PRINT_BFS: print_bfs(graph, options.source); break; case DETAILED_PATH: detailed_path(graph, options.source, options.dest); break; case ALL_PATHS: all_paths(graph, options.source, options.dest); break; case SHORTEST_PATH: shortest_path(graph, options.source, options.dest); break; } // clean up free_graph(graph); // done! exit(EXIT_SUCCESS); }