CSD201_-_1_-_FA_2023_-_FE_1030.webp
H

CSD201_-_1_-_FA_2023_-_FE_1030.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.
A. void push(Object x)
Specify the correct implementation of push() method of the stack. (Choose the most suitable one)
{ Node p = new Node(x);
p.next = head;
head=p;}
B. void push(Object x)
{ Node p = new Node(x);p.next = head;}
C. void push(Object x)
{ Node p = new Node(x);
p.next = null;
head=p;
}
D. void push(Object x)
{ Node p = new Node(x);
p.next = head;head=p.next;
}


Exit (31

Thông tin

Category
CSD201
Thêm bởi
happy_smile1
Ngày thêm
Lượt xem
3,706
Lượt bình luận
23
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_1_-_FA_2023_-_FE_1030.webp
File size
57.7 KB
Dimensions
1542px x 690px

Share this media

Back
Bên trên Bottom