某外企面试题,有大神帮解答一下
Cyclic module dependencies: Are there any in StdLib?
Software libraries and system sometimes contain cyclic dependencies, when a class or a function A depends on B which it turn depends on C … on Z which depends on A. Such dependencies are considered as design flaws, but not always (for example, in functional programming recursive dependencies is a standard construct).
Write a function find_cycles() which will compute all cyclic dependencies in the StdLib. Use this function in the function task5() to report on the findings, with the output looking like that:
The StdLib packages form a cycle of dependency:
1. package_A -> package_B -> package_C -> ...
2. package_D -> package_A -> package_Z -> ...
3. package_O -> package_Y -> package_B -> ...
The names package_X should be the StdLib package names found.
Software libraries and system sometimes contain cyclic dependencies, when a class or a function A depends on B which it turn depends on C … on Z which depends on A. Such dependencies are considered as design flaws, but not always (for example, in functional programming recursive dependencies is a standard construct).
Write a function find_cycles() which will compute all cyclic dependencies in the StdLib. Use this function in the function task5() to report on the findings, with the output looking like that:
The StdLib packages form a cycle of dependency:
1. package_A -> package_B -> package_C -> ...
2. package_D -> package_A -> package_Z -> ...
3. package_O -> package_Y -> package_B -> ...
The names package_X should be the StdLib package names found.
全部评论
突然就感觉外企我不配
相关推荐
07-25 18:06
门头沟学院 Java 点赞 评论 收藏
分享
07-19 13:28
长沙学院 Java 点赞 评论 收藏
分享

点赞 评论 收藏
分享