我有这种格式的输入文本文件:
<target1> : <dep1> <dep2> ...
<target2> : <dep1> <dep2> ...
...
Run Code Online (Sandbox Code Playgroud)
以及一个采用两个参数的方法
function(target, dep);
Run Code Online (Sandbox Code Playgroud)
我需要让这个解析来调用我的方法与每个目标和dep,例如:
function(target1, dep1);
function(target1, dep2);
function(target1, ...);
function(target2, dep1);
function(target2, dep2);
function(target2, ...);
Run Code Online (Sandbox Code Playgroud)
调用function(target,dep)文本文件的每一行最有效的方法是什么?我试过用扫描仪和string.split搞错,但没有成功.我很难过.
谢谢.
for(int i=1; i<n; i=2*i)
// simple addition performed here...
Run Code Online (Sandbox Code Playgroud)
我理解O(n)运行时单循环和O(n ^ 2)嵌套循环但是这个循环的运行时也是n log n,因为乘法?
谢谢,