CSD201_-_SP_2024_-_Block_5_-_FE_1949.webp
Nakime93

CSD201_-_SP_2024_-_Block_5_-_FE_1949.webp

  • Media owner Nakime93
  • Ngày thêm
Multiple Choices
(Choose 1 answer)
Suppose we are implementing a queue using a singly linked list where the the head of the list is treated as the head of the queue.
Specify the correct implementation of dequeue() method of the queue. (Choose the most suitable one)
A. Object dequeue(){ if(isEmpty()) return(null);Node p = head;head-head.next;if(head==tail) tail=null;
return(p.info);
}
B. Object dequeue(){ if(isEmpty()) return(null);Node p = head;head-head.next;
return(p.info);
}
C. Object dequeue(){if(isEmpty()) return(null);
Node p = head;head-head.next;if(head==null) tail=null;
return(p.info);
}
D. Object dequeue(){if(isEmpty()) return(null);head-head.next;if(head.next==null) tail=null;
return(head.info);
}

  • Like
Reactions: trantrungdung45

Thông tin

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

Share this media

Back
Bên trên Bottom