1

I'm looking at this Big O cheat sheet: https://www.bigocheatsheet.com/

I don't understand the following when looking at Hash Tables and Binary Search Trees.

Hash Tables: Access: N/A

Binary Search Tree: Access: O(log N)

Why is the Access operation of a Binary Search Tree O(log N) but for a Hash Table it is N/A?

I understand "Access" as indexing, for example in an array if you want to access the 3rd element, that is O(1). I could understand how "Access" for a Hash Table is N/A because we can't access the 3rd element because elements are not indexed. I'm getting confused with the Binary Search Tree, if we want to access the 3rd element, how is that possible? I don't believe they are indexed. Shouldn't "Access" for a Binary Search Tree be N/A as well.

I understand that Access and Search are two different operations.

1 Answers1

1

I believe the access here is in-order access and not insertion order.

Shashank V
  • 10,007
  • 2
  • 25
  • 41