I am writing a code to implement separate chaining while implementing hashing. My question is that when I will insert a large number of entries then there obviously will be a lot of collisions resulting in the large linked lists. How do I maintain an O(1) time in searching then? I can implement a self-balancing BST instead of the linked list. But that will also require O(log n) time.