Arrays and hash tables are great for storing flat collections of data. But what about data that’s naturally hierarchical — like a company org chart, a file system, or the rules in a decision-making process? That’s where trees come in. Trees are one of the most widely used data structures in computer science, and a solid understanding of them will help you with everything from database internals to coding interviews. In this post, we’ll cover what trees are, the most important types, and how to traverse them in four different ways. What Is a Tree? A tree is a hierarchical READ MORE
Tag: bst
Intro to Binary Search Tree
Binary search tree is very efficient and has strengths of array and linked list.Array and Linked List are great data structure but they have some weaknesses.It’s fast to access array but slow to adjust the size.It’s slow to access linked list but fast to adjust the size.However, it’s fast to access binary search tree and it’s still very flexible to adjust the size. What is Binary Tree? Before diving into binary search tree we need to understand binary tree first.Binary tree is an extended form of singly linked list but has two pointers to other nodes (children) instead.Pointers are not READ MORE