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

20. Write a complete method from the implementation perspective called display()

ID: 3733467 • Letter: 2

Question

20.

Write a complete method from the implementation perspective called display(). The method will be go in the LList class.

LList implements ListInterface using linked nodes.

The method prints to the console the list index of each element along with the element.

Be sure to account for all possible times when the method could be invoked. Your code should not crash.

For full credit, write a method that is efficient (meaning better than O(n2)).

The method header is:

For this question, you are writing code at the implementation level. This means you have access to the private instance data variables:

private Node firstNode

private int numberOfEntries

You can assume the following methods are already implemented:

Note that toArray is not listed and should not be used in your solution.

27.

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

4n2

4n2

Explanation / Answer

Please find my answer for Q27.

Please repost others in separate post.

4n^2 : false, constant 4 should be ignored

1 : true
    n : true
    2n : false, constant 2 should be ignored
    log n : true
    n log n : true
    n^2 : true
    2^n :
    2 : false, it should be 1
    n^2+n : false, lower order terms should be ignored, it should be n^2