我很困惑为什么这个多项选择题的最终答案(选择 e.)是错误的:
Which of the following statements is the most accurate regarding linked lists?
a. Linked-lists take up more space than STL vectors because they allocate extra storage
space for future growth.
b. The asymptotic complexity of inserting at the end of a doubly-linked list container
storing only the pointer to the first element is O(1).
c. A loop in a singly-linked-list can be found in O(log(n)) time and O(n) memory overhead
d. A loop in a singly-linked-list can be found in O(n) time and O(1) memory overhead.
e. The number of elements in a linked-list is end_ptr -start_ptr + 1, where start_ptr points
to the first element in the linked list and end_ptr points to the last item of the linked-list.
也就是说,为什么两者都不是d。和 e。正确的?在什么情况下,迭代器会返回带有 的大小end_ptr-start_ptr+1
,在什么情况下不会?选择应该end_ptr-start_ptr
改为说明吗?