CSD201_-_SU_2023_-_Block_5_-_RE_759.webp
Vân Anh1

CSD201_-_SU_2023_-_Block_5_-_RE_759.webp

(Choose 1 answer)
Suppose we are implementing a stack using a singly linked list where the head of the list is treated as the top of the stack.
Specify the correct implementation of pop() method of the stack. (Choose the most suitable one)
A. Object pop()
{ if(isEmpty()) return(null);Node p = head;head=head.next;if(head==tail) tail=null;return(p.info);}
B. Object pop(){ if(isEmpty()) return(null);Node p = head;head-head.next;return(p.info);}
C. Object pop(){ if(isEmpty()) return(null);Node p = head;head=head.next;if(head==null) tail=null;return(p.info);
}
D. Object pop()
{ if(isEmpty()) return(null);
head=head.next;
if(head next==null) tail=null


Exit 50

Thông tin

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

Image metadata

Filename
CSD201_-_SU_2023_-_Block_5_-_RE_759.webp
File size
62.2 KB
Dimensions
1542px x 690px

Share this media

Back
Bên trên Bottom