CSD201_-_SP_2024_-_Block_5_-_RE_1957.webp
thanhvan86

CSD201_-_SP_2024_-_Block_5_-_RE_1957.webp

(Choose 1 answer)
Suppose we are implementing a queue using a singly linked list where the end of the list is treated as the end of the queue.
Specify the correct implementation of enqueue() method of the queue. (Choose the most suitable one)
A. void enqueue(Object x)
{ Node p = new Node(x);
p.next = null;
tail.next = p;
tail = p;}
B. void enqueue(Object x)
{ Node p = new Node(x);
p.next = null;
}
if(isEmpty())
head = tail = p;else
{tail.next = p;
tail = p;
}
C. void enqueue(Object x){ Node p = new Node(x);
p.next = null;
if(isEmpty())head = tail = p;
else
tail.next = p;
}
FUO
43

Thông tin

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

Image metadata

Filename
CSD201_-_SP_2024_-_Block_5_-_RE_1957.webp
File size
237.6 KB
Dimensions
1920px x 892px

Share this media

Back
Bên trên Bottom