Question: Consider the following algorithm: Algorithm insertDbl ( list , dataIn ) This algorithm inserts data into a doubly linked list. Pre list is metadata structure
Consider the following algorithm:
Algorithm insertDbl list dataIn
This algorithm inserts data into a doubly linked list.
Pre list is metadata structure to a valid list dataIn contains the data to be inserted
Post The data have been inserted in sequence
Return : faileddynamic memory overflow
: successful
: failedduplicate key presented
if full list
return
end if
set found to searchList list predecessor, successor, dataIn key
if not found
allocate new node
move dataIn to new node
if predecessor is null
set new node back pointer to null
set new node fore pointer to list head
set list head to new node
else
set new node fore pointer to predecessor fore pointer
set new node back pointer to predecessor
end if
if predecessor fore null
set list rear to new node
else
set successor back to new node
end if
set predecessor fore to new node
return
end if
return
endinsertDbl
What does the condition if predecessor fore null test for?
Question Select one:
a
insertion at end of list
b
insertion in an empty list
c
insertion at beginning of list
d
insertion in a null list
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
