AfterAcademy Tech
•
06 Feb 2020

In the Concept of Hashing in programming, blog, we learned the concept of Hashing. So, now we know the concepts of both the hash tables and of binary search trees also. So, which data structure should be used? Should we use the Hash Table or BST? Let's find out.

So we have seen the differences between the Binary Search Tree and Hash Table. Now, the question that arises here is that when should we use BST over Hash Table and where should we prefer Hash Table over BST? Should we always use a Hash Table because the time complexity of insertion, deletion, and searching is O(1) or we should use BST?
The usage of BST and Hash Table depends on the need of the situation. Let's see how!
If you know the size of the input, then you can use the Hash Table. But if you are not sure about the input size, then you should go with BST. Also, if you are not so familiar with the input size, but after inserting all the data, the operation that you are following is retrieval, deletion, then you should use the Hash Table. But if you are continuously inserting, updating, deleting, and retrieving data, then go for BST.
Therefore, the use of Hash Table and BST depends on the problem at hand!
That's it for this blog.
Happy Learning, Enjoy Algorithms!
Team AfterAcademy!
AfterAcademy Tech
Binary Search Trees is one of the most important variation of binary tree and is extremely useful in practical applications. The blog discusses the operations and applications of this powerful data structure

AfterAcademy Tech
Given a Binary Search Tree such that two of the nodes of this tree have been swapped by mistake. You need to write a program that will recover this BST while also maintaining its original structure

AfterAcademy Tech
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. This is a very famous interview problem and previously asked in Microsoft and Amazon.

AfterAcademy Tech
Hashing is a way to store data into some data structure (generally Hash Table is used) in such a way that the basic operations on that data i.e. the insertion, deletion, and searching can be performed in O(1) time. It is one of the important concepts that every programmer and developer should know. In this blog, we will know some of the applications on Hash Table.
