Why is clear an O(n) operation for linked list?
问题 According to attachment 1, linked list's clear operation is O(n). I have a question about why is it so. Here is how we implemented the linked list in class(java) public class LinkedIntList { private ListNode front; ...... } And if I were to write a clear method for this linked list class, this is how I would write it public void clear() { front = null; } Given this implementation(think this is how most people would write this), this would be one operation that is independent of the size of