Select the most correct statement:
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "In a linked list, the tail node is introduced for performance purpose only.". Một danh sách liên kết chỉ cần biến head là đủ để biểu diễn trọn vẹn dữ liệu: muốn tới nút cuối thì dò từ head cho tới khi gặp nút có next là null. Giữ thêm biến tail không thêm thông tin nào mà chỉ rút ngắn thao tác ở cuối danh sách từ O(n) xuống O(1), nên nó thuần là chuyện hiệu năng. "In a linked list, there must be the tail node." sai vì rất nhiều hiện thực chỉ có head vẫn chạy đúng mọi phép thêm, xoá, tìm. "The tail node is necessary for inserting a node after the last node" sai vì không có tail ta vẫn chèn được vào sau nút cuối, chỉ phải dò một lượt để tìm nút cuối. "The tail node is necessary for inserting a node before the last node" càng sai: trên danh sách liên kết đơn, chèn trước nút cuối cần nút đứng trước nút cuối, mà tail không cho biết nút ấy nên vẫn phải dò từ head.
Cùng phần 1
Suppose a doubly linked list of integers is given below and p is a reference to the node with value 30 in the list (i.e. p.info=30):
(head) 7 11 6 4 30 9 8 2 (tail)
What does the list look like after the following java code snippet is run?
Node p1,p2; p1 = p.next;
p2 = p1.next;
p.next = p2;
if(p2!=null) p2.prev=p;Có lời giảiCâu hỏiSuppose a doubly linked list of integers is given below and p is a reference to the node with value 13 in the list (i.e. p.info=13):
(head) 7 11 6 4 32 13 8 2 (tail)
What does the list look like after the following java code snippet is run?
int x = 17;
Node q = new Node(x);
q.prev=null;
q.next = head;
head.prev = q;
head = q;Có lời giảiCâu hỏiSelect the statement that is most correct.
Basically, the complexity of getting an element at the middle of a singly linked lists isCó lời giảiCâu hỏiCả 64 câu của chủ đề64 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây