Preskoči na glavni sadržaj
Prijava
Sign up for FREE
arrow_back
Biblioteka

Sort Search BigO Iterator M/C Test

star
star
star
star
star
Posljednje ažuriranje about 2 years ago
40
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Pitanje 1
1.

Which of the following sorts has a partition method that uses a pivot location?

Pitanje 2
2.

What is the bigO of the code below?

int n = //user input

for(int i=0; i<n; i++){

for(int j=0; j<n; j++){

System.out.println(i*j);

}

}

Pitanje 3
3.

What is the bigO of the code below?

int n = //user input

for(int i=0; i<n; i++){

for(int j=1; j<n; j=j*2){

System.out.println(i*j);

}

}

Pitanje 4
4.

What is output by the code below?

String[] s = "one two dog".split(" ");

ArrayList<String> words;

words = new ArrayList<String>(Arrays.asList(s));

String big = Collections.min(words);

out.println(big);

Pitanje 5
5.

Which of the these algorithms has a O(1) best case runtime and a O(N) worst case runtime?

Pitanje 6
6.

Which of the these algorithms has a O(N) best case runtime and a O(N*N) worst case runtime?

Pitanje 7
7.

Which of the these algorithms has a O(N*Log2N) best case runtime and a O(N*N) worst case runtime?

Pitanje 8
8.

Which of the following sorts selects an item and then moves items around to put the selected item in the correct location?

Pitanje 9
9.

Which of these is the correct BigO for searching a single linked linked-list?

Pitanje 10
10.

Which of the these algorithms has a O(N*N) best case runtime and a O(N*N) worst case runtime?

Pitanje 11
11.

Which of the these algorithms has a O(1) best case runtime and a O(Log2N) worst case runtime?

Pitanje 12
12.

Which of these is the correct BigO for adding an item to the front of an array?

Pitanje 13
13.

Which of these is the correct BigO for adding an item to the end of an array?

Pitanje 14
14.

Which of these is the correct BigO for adding an item to the front of a Java LinkedList?

Pitanje 15
15.

Which of these is the correct BigO for deleting any item from an ArrayList?

Pitanje 16
16.

Which of the following would correctly fill < blank 1 > ?

public static void sortOne( Comparable[] list )

{

for(int i=0; i<list.length-1; i++)

{

int min = i;

for(int j=i+1; j<list.length; j++)

{

if(list[j]. < blank 1 > (list[min])<0)

min = j;

}

if( min != i)

{

Comparable temp = list[min];

list[min] = list[i];

list[i] = temp;

}

}

}

Pitanje 17
17.

Assuming <blank 1> is filled correctly, what sort is sortOne()?

public static void sortOne( Comparable[] list )

{

for(int i=0; i<list.length-1; i++)

{

int min = i;

for(int j=i+1; j<list.length; j++)

{

if(list[j]. < blank 1 > (list[min])<0)

min = j;

}

if( min != i)

{

Comparable temp = list[min];

list[min] = list[i];

list[i] = temp;

}

}

}

Pitanje 18
18.
Pitanje 19
19.
Pitanje 20
20.
Pitanje 21
21.
Pitanje 22
22.
Pitanje 23
23.
Pitanje 24
24.
Pitanje 25
25.
Pitanje 26
26.
Pitanje 27
27.
Pitanje 28
28.
Pitanje 29
29.
Pitanje 30
30.
Pitanje 31
31.
Pitanje 32
32.
Pitanje 33
33.
Pitanje 34
34.
Pitanje 35
35.
Pitanje 36
36.
Pitanje 37
37.
Pitanje 38
38.
Pitanje 39
39.
Pitanje 40
40.