subject

(a) Write an iterative algorithm in Java-like pseudocode for printing a singly linked list in reverse in O(N) time. You can use as much extra space as you need. The original list pointers CAN NOT BE MODIFIED. State in big-O notation how much extra space is used by this algorithm.
NOTE: The reason you are not allowed to implement the algorithms recursively, is due to the additional space requirements of recursive calls. Around N recursive calls has an additional space complexity of O(N) as each recursive call is placed on a call-stack that requires memory to keep track of.
(b) Write another iterative algorithm in Java-like pseudocode for printing a singly linked list in reverse using O(1) extra space. The original list pointers CAN NOT BE MODIFIED. This algorithm can have any runtime (it will be worse than the algorithm in part a). State the runtime of your algorithm in big-O notation.
NOTE: The reason you are not allowed to implement the algorithms recursively, is due to the additional space requirements of recursive calls. Around N recursive calls has an additional space complexity of O(N) as each recursive call is placed on a call-stack that requires memory to keep track of.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
You know the right answer?
(a) Write an iterative algorithm in Java-like pseudocode for printing a singly linked list in revers...
Questions
question
History, 15.12.2021 18:00
question
Arts, 15.12.2021 18:00
question
Geography, 15.12.2021 18:00
Questions on the website: 13722363