What are the key differences between a binary search tree and a hashtable in terms of their structure and performance characteristics?
A binary search tree is a data structure that organizes data in a hierarchical manner, where each node has at most two children. It allows for efficient searching, insertion, and deletion operations with a time complexity of O(log n) on average. On the other hand, a hashtable is a data structure that uses a hash function to map keys to values, providing constant time complexity O(1) for operations like insertion, deletion, and retrieval. However, hash tables do not maintain any specific order of elements, unlike binary search trees which are ordered based on their keys.