
What is a Data Structure ? A data structure is a particular way of organizing data is a computer program effectively.
Algorithms are collections of steps to solve a particular problem.
Types of Data Structures
- Linear Data Structures
- Non - Linear Data Structures
Linear DS
In linear data structures, individual elements are arranged in a sequential manner(one after the other). This is a good option for story simple data types with simpler operations demands.
Examples of Linear DS
Arrays - In an Array, elements in memory are arranged in continuous memory. All the elements of an array are of the same type, and the type of elements that can be stored in the form of arrays is determined by the programming language.
Stacks - Stacks implement either LIFO principle(Last in, First Out). i.e the last element in a stack will be accessed first from the list. Picture a rack of crates, the last create on top will be the first one to be removed from the pile.
Queues- Queues work the exact opposite with stacks. Just like it would be in a line of people queuing to received services, the first on the queue gets served first, hence the FIFO principle of ( First In, First Out)
Linked List- In a linked list, data elements are connected through a series of nodes, with each node containing the data item and a memory address linking to the next node.
Non -Linear DS
Unlike linear data structures, elements in non-linear are not stored sequentially. Instead, they are arranged in a hierarchical manner where one element is connected to one or more elements, like a family tree or a cooperate ladder. Non-linear data structures are further divided into graphs and tree-based data structures.
Examples of Non-Linear DS
Trees DS: Similar to a graph, a tree is also a collection of vertices and edges. However, in trees, there can only be one edge between two vertices.
Graph DS: In the graph data structure, each node is called a vertex and each vertex is connected to other vertices through edges.
Common Tree-Based Data Structure
Binary Tree
Binary Search Tree
AVL Tree
Red-Black Tree
- B-Tree
- B+ Tree
Just for Practice, This is my first blog post in 15mins! It will only get better! :-)