Which of the following pseudocode algorithms correctly inserts a record called n
ID: 3557333 • Letter: W
Question
Which of the following pseudocode algorithms correctly inserts a record called
new_record immediately after the record called current_record in a linked
list?
(HINT: to help you solve the problem, draw a picture of a linked list with 3 items,
where current_record is the middle item. Draw new_record outside the list,
then follow the steps of each algorithm to see how the list is changed.)
Algorithm #1
1. set the pointer field of current_record to point to new_record
2. set the pointer field of new_record to point to the record pointed to by
current_record
Algorithm #2
1. set the pointer field of new_record to point to the record pointed to by
current_record
2. set the pointer field of current_record to point to new_record
correct algorithm is: ________________________
briefly, what is wrong with the other algorithm?
_________________________________________________________________
______________________________________________________________
Explanation / Answer
correct algorithm is: ___Algorithm #1_____________________
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.