Legacy Code: Difference between revisions

From programming_contest
Jump to navigation Jump to search
Created page with "This problem gives us a list of function names and the functions that CALL those functions and asks, given the top-level set of functions we know are called, how many listed f..."
(No difference)

Revision as of 07:30, 25 September 2018

This problem gives us a list of function names and the functions that CALL those functions and asks, given the top-level set of functions we know are called, how many listed functions are not reached?

This is a typical BFS problem. Simply build an adjacency list as you read the input and then BFS from any function which matches the regex "::Program$". Return the count of unreached functions. Ensure to deal with the case of having zero or multiple "program" functions.