Skip to main content

All you need is RIGHT Data Structures at RIGHT implementation.

So, lets erase the confusion of what, which, when the data structure to be used through this article.
As part of academic we are well known that, data structures are classified into Linear and Non-Linear Data Structures.

Linear are the Data Structures like Array, Sorted Array, Stack, Queue, Linked List.
Non-Linear are the Data Structures Like Binary Tree, Red-Black Tree, 2-3-4 Tree, Graph, Hash Table, Heap

Array:
Advantages:
1. Quick Insertion
2. Quick Access of any element in the array
Disadvantages:
1. Slow Deletion
2. Slow Search

Sorted Array:
Advantages:
1. Quick Search
2. Quick Access of any element
Disadvantages:
1. Slow Deletion, Insertion

Stack:
Advantages:
1. Last In First Out access
Disadvantages:
1. Slow Access, Search for remaining elements

Queue:
Advantages:
1. First In First Out Access
Disadvantages:
1. Slow Access, Search for other elements

Linked List:
Advantages:
1. Quick Insertion, Deletion
Disadvantages:
1. Slow Search

Binary Tree:
Advantages:
1. Quick Search, Insertion, Deletion ( If the Tree is BALANCED )
Disadvantages:
1. Deletion Algorithm is complex

Red-Black Tree:
Advantages:
1. Quick Search, Insertion, Deletion ( Tree is ALWAYS BALANCED )
Disadvantages:
1. Complex

2-3-4 Tree:
Advantages:
1. Quick Search, Insertion, Deletion ( Tree is ALWAYS BALANCED )
2. Good for Disk Storage
Disadvantages:
1. Complex

Hash Table:
Advantages:
1. Fast Access if the key is known
2. Fast Insertion
Disadvantages:
1. Slow Access, Insertion

Heap:
Advantages:
1. Fast Insertion, Deletion
2. Fast Access to the largest item
Disadvantages:
1. Slow Access to the remaining items

Comments

Popular posts from this blog

Sexy C#

Download samples   Table of Contents   1.   Introduction  2.   Background    3.   Sexy Features 3.1.   Extension Methods   3.2.   Anonymous Type   3.3.   Delegate   3.4.   Lambda Expression 3.5.   Async-Await Pair   3.6.   Generics   4.   Conclusion   1. Introduction     C#  is a very popular programming language. It is mostly popular in the .NET arena. The main reason behind that is the C# language contains so many useful features. It is actually a multi-paradigm programming language. Q.   Why do we call C# a muti-paradigm programming language? A.  Well, C# has the following characteristics:  Strongly typed   Object Oriented  Functional  Declarative Programming  Imperative Programming   Component based Programming Dynamic Programming ...

Kubernetes – init containers, CNI and more

Certain questions about Kubernetes seem to come up again and again: What’s up with this init container stuff? What’s a CNI plugin? Why is Kubernetes complaining about pods not finishing initialisation? Kubernetes is a complex system with a simple overall purpose: run user  workloads  in a way that permits the authors of the workloads to not care (much) about the messy details of the hardware underneath. The workload authors are supposed to be able to just focus on Pods and Services; in turn, Kubernetes is meant to arrange things such that workloads get mapped to Pods, Pods get deployed on Nodes, and the network in between looks flat and transparent. This is simple to state, but  extremely  complex to implement in practice. (This is an area where Kubernetes is doing a great job of making things complex for the Kubernetes implementors so that they can be easier for the users – nicely done!) Under the hood, Kubernetes is leaning heavily on a number of technologies to ma...

Python Subprocess Module

Subprocess A running program is called a  process . Each process has its own system state, which includes memory, lists of open files, a program counter that keeps track of the instruction being executed, and a call stack used to hold the local variables of functions. Normally, a process executes statements one after the other in a single sequence of control flow, which is sometimes called the main thread of the process. At any given time, the program is only doing one thing. A program can create new processes using library functions such as those found in the os or subprocess modules such as  os.fork() ,  subprocess.Popen() , etc. However, these processes, known as  subprocesses , run as completely independent entities-each with their own private system state and main thread of execution. Because a subprocess is independent, it executes concurrently with the original process. That is, the process that created the subprocess can go on to work on other thing...