Junior Collections

What is the time complexity of adding or removing elements in a LinkedList<T>?

  • Adding or removing at the start or end: O(1)
  • Adding or removing at an arbitrary position (if you already have the node

reference): O(1)

  • Searching for a node by value: O(n), because traversal is required

More from C# Programming Tutorial

All questions for this course