Question: Q1. [3 points] Write a method public Node getSecondToLast(SList S) that takes a Singly List as a parameter. This method returns a reference to the
![Q1. [3 points] Write a method public Node getSecondToLast(SList S) that](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e1d18b94ee7_27566e1d18b19243.jpg)
Q1. [3 points] Write a method public Node getSecondToLast(SList S) that takes a Singly List as a parameter. This method returns a reference to the node before the last node in the list. Q2. [3 points] Imagine a non-empty CircularList does not have a size variable defined in the class. Write the method public int size 0 which returns the size of this CircularList. Q3. [3 points] Write a method public SList cloneSList(SList S) that takes a Singly List as a parameter. This method creates a copy of the provided list and returns reference to the newly created Singly List. The original list must not be destroyed. Q4. [3 points] Write a method that uses iteration to compute and return the sum of all positive integers in a single dimension array. Analyse this algorithm by showing the number of operations and give the asymptotic running time using the Big Oh notation for the best and the worst cases. Q5. [3 points] Write the method given in Q4 using recursion. Show recurrences using tracing and estimate the running time giving Big Oh notation using the substitution method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
