Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Timing and Efficiency Java Please help me with these multiple choice questions.

ID: 3733470 • Letter: T

Question

Timing and Efficiency Java

Please help me with these multiple choice questions. Thank you very much.

1/ What is the order of growth of the following operations for lists implemented with arrays?

add to the beginning of a list  

      [ Choose ]            O(1)            O(n)            O(n^2)      

add to the end of a list

      [ Choose ]            O(1)            O(n)            O(n^2)      

delete from the beginning or middle of a list

      [ Choose ]            O(1)            O(n)            O(n^2)      

delete from the end of a list

      [ Choose ]            O(1)            O(n)            O(n^2)      

determine if the list contains an element

      [ Choose ]            O(1)            O(n)            O(n^2)      

retrieve an element at a specific position

2. What is the order of growth of the following operations for lists implemented with linked nodes with a head pointer only?

add to the beginning of a list  

      [ Choose ]            O(n^2)            O(1)            O(n)      

add to the end of a list

      [ Choose ]            O(n^2)            O(1)            O(n)      

delete from the beginning of a list

      [ Choose ]            O(n^2)            O(1)            O(n)      

delete from the end of a list

      [ Choose ]            O(n^2)            O(1)            O(n)      

determine if the list contains an element

      [ Choose ]            O(n^2)            O(1)            O(n)      

retrieve an element at a specific position

3. What is the order of growth of the following operations for lists implemented with linked nodes with a head and a tail pointer?

add to the end of a list

      [ Choose ]            O(n)            O(1)            O(n^2)      

delete from the end of a list

      [ Choose ]            O(n)            O(1)            O(n^2)      

4. Which of the following has the largest order of growth?

a/ n b/ n^2 c/ 2^n d/ logn e/ n^4

5. Which of the following has the smallest order of growth?

a/ n b/ n^2 c/ 2^n d/ logn e/ n^4

6. Which of the following are valid values for big-oh? Select all that apply.

4n2

n2+n

7. What is the order of growth of T( n ) = 3n2 + 4n3 +3 n

O(3n2)

8.Select the order of growth for the following algorithm.

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

statement1

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

statement2

for(int k=1; k<=5; k++) {

statement3

}

statement4

}

statement5

}

statement6

none of the above

8.

Select the order of growth for the following algorithm.

statement1

for i=2 to n-1 {

if(condition1) {

for j=1 t n

statement3

} else {

statement3

}

statement5

}

statement6

4n2

Explanation / Answer

Hi.. Please check below answers.

Timing and Efficiency Java

Please help me with these multiple choice questions. Thank you very much.

1/ What is the order of growth of the following operations for lists implemented with arrays?

add to the beginning of a list  

[ Choose ] O(1) O(n) O(n^2)

add to the end of a list

[ Choose ] O(1) O(n) O(n^2)

delete from the beginning or middle of a list

[ Choose ] O(1) O(n) O(n^2)

delete from the end of a list

[ Choose ] O(1) O(n) O(n^2)

determine if the list contains an element

[ Choose ] O(1) O(n) O(n^2)

retrieve an element at a specific position

Answer:

determine if the list contains an element

[ Choose ] O(1) O(n) O(n^2)

retrieve an element at a specific position

2. What is the order of growth of the following operations for lists implemented with linked nodes with a head pointer only?

add to the beginning of a list  

[ Choose ] O(n^2) O(1) O(n)

add to the end of a list

[ Choose ] O(n^2) O(1) O(n)

delete from the beginning of a list

[ Choose ] O(n^2) O(1) O(n)

delete from the end of a list

[ Choose ] O(n^2) O(1) O(n)

determine if the list contains an element

[ Choose ] O(n^2) O(1) O(n)

retrieve an element at a specific position

Answer:

add to the beginning of a list  

[ Choose ] O(n^2) O(1) O(n)

3. What is the order of growth of the following operations for lists implemented with linked nodes with a head and a tail pointer?

add to the end of a list

[ Choose ] O(n) O(1) O(n^2)

delete from the end of a list

[ Choose ] O(n) O(1) O(n^2)  

Answer:

add to the end of a list

[ Choose ] O(n) O(1) O(n^2)

4. Which of the following has the largest order of growth?

a/ n b/ n^2 c/ 2^n d/ logn e/ n^4

Answer: c

2^n

5. Which of the following has the smallest order of growth?

a/ n b/ n^2 c/ 2^n d/ logn e/ n^4

Answer: d

log n

6. Which of the following are valid values for big-oh? Select all that apply.

4n2

1

n

2n

log n

n log n

n2

2n

2

Answer: 1,n,log n, n log n

n2+n

7. What is the order of growth of T( n ) = 3n2 + 4n3 +3 n

O(1)

O(3)

O(n)

O(n2)

O(n3)

O(n2)

O(4n3)

O(3n)

O(3n2)

Answer: O(3n2)

8.Select the order of growth for the following algorithm.

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

statement1

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

statement2

for(int k=1; k<=5; k++) {

statement3

}

statement4

}

statement5

}

statement6

O( n )

O(n2)

O(n3)

O(n4)

O(nlogn)

none of the above

Answer: o(n3)

because it iterates the loop as 3 times as 3 for loops.

8.

Select the order of growth for the following algorithm.

statement1

for i=2 to n-1 {

if(condition1) {

for j=1 t n

statement3

} else {

statement3

}

statement5

}

statement6

O( n )

O(n2)

O(n3)

O(n4)

O(nlogn)

O(logn)

none of the above

Answer: O(nlogn)

Please check the above and let me know any issues. Thank you. All the best.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote