Q1.webp
V

Q1.webp

Question: 1
(Choose 1 answer)
You are given a singly linked list with at least 3 elements and p is a reference to a middle node (p is not the
head nor the tail node).
Select the statement about deleting the node p from the list that is most correct.
A. Deleting the node p always takes O(n) time.
B. Deleting the node p always takes O(1) time.
C. We can delete the node p by moving the data from the next node into the p node and then deleting the next
node by statement p.next = p.next.next; This solution has O(1) runtime.
D. We can find the node f before the node p and then deleting the node p by statement f.next=p.next; This
solution has O(1) runtime.

Thông tin

Category
CSD201
Thêm bởi
Văn Bình
Ngày thêm
Lượt xem
2,342
Lượt bình luận
4
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom