Just have few questions i have on homework Chapter 3 of Data Structures and algorithms. I want to know if i got the answers right. if the answer is wrong, just want to know why.

What is the running time of the following code?
Code:
public static List<Integer> makeList( int N )
{
ArrayList<Integer> lst = new ArrayList<>( );
for( int i = 0; i < N; i++ )
{
lst.add( i );
lst.trimToSize( );
}
}

Answer: o(sqrt(n))



------------------------------------------------

The following routine removes the first half of the list passed as a parameter:
Code:
public static void removeFirstHalf( List<?> lst )
{
int theSize = lst.size( ) / 2;
for( int i = 0; i < theSize; i++ )
lst.remove( 0 );
}

a. Why is theSize saved prior to entering the for loop?

So that the correct size of the list is used and only the first half is removed.

b. What is the running time of removeFirstHalf if lst is an ArrayList?

o(n)

c. What is the running time of removeFirstHalf if lst is a LinkedList?

o(n)

d. Does using an iterator make removeHalf faster for either type of List?

Dont know the answer