问个算法题# JobHunting - 待字闺中
t*c
1 楼
//lst1 has N items, and lst2 has M items
public static void Print( List lst1, List lst2)
{
Iterator itr1 = lst1.iterator();
Iterator itr2 = lst2.iterator();
while (itr1.hasNext() || itr2.hasNext())
{
int x=0, y=0;
if (itr1.hasNext())
{
x = itr1.next();
System.out.println(x);
}
if (itr2.hasNext())
{
y = itr2.next();
System.out.println(y);
}
}
}
这道题,不管lst1和lst2是Array还是linked, big(o)都是一样吧,就是M,N里的最
大值吧
谢谢!
public static void Print( List
{
Iterator
Iterator
while (itr1.hasNext() || itr2.hasNext())
{
int x=0, y=0;
if (itr1.hasNext())
{
x = itr1.next();
System.out.println(x);
}
if (itr2.hasNext())
{
y = itr2.next();
System.out.println(y);
}
}
}
这道题,不管lst1和lst2是Array还是linked, big(o)都是一样吧,就是M,N里的最
大值吧
谢谢!