我应该如何将这段代码转换为伪代码?
ArrayList<Integer> check = new ArrayList<Integer>();
ArrayList<Integer> dup = new ArrayList <Integer> ();
ArrayList<Integer> nonDup = new ArrayList <Integer> ();
for (int i : listA) {
nonDup.add(i);
}
for (int i : listB) {
nonDup.add(i);
}
for (int i : listA) {
check.add(i);
}
for (int i : listB) {
if (check.contains(i)) {
dup.add(i);
nonDup.removeAll(duplicates);
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何将for循环,add(),contains()和removeAll()方法转换为伪代码.
PseudoCode可以是你想要的任何东西.由于您或其他人可以理解线条的含义.
你可以把它变成简单的FOR(你的变量值开始)TO(你想要的结束)i ++ -
基本上是让人和你大多数人理解它是For Loop的东西
| 归档时间: |
|
| 查看次数: |
17624 次 |
| 最近记录: |