Just here to share whatever I've learned in Data Structures and Algorithms
Merge Sort is a sorting technique based on divide and conquer strategy. It is one of the efficient sorting algorithms as its worst case time complexity is of the order of nlog(n).
What is Merge Sort?
It is a sorting algorithm that makes use of Divide and Conquer method to sort an array of unsorted elements. It recursively breaks...
Divide and conquer is just a simple yet complex strategy of solving problems. It basically includes the idea of dividing a problem into sub-problems or smaller problems. We solve each sub-problem one by one until all the sub-problems are solved.
This strategy is useful when you're given a task of solving a bigger problem with hi...
Insertion sort is a technique of sorting wherein you build a sorted array from an unsorted one by picking wrongly placed elements from the unsorted part of the array and placing them at the correct position in the sorted part.
What is insertion sort?
In this technique of sorting, we basically select an element of the array at a...
In this article I'm gonna talk about selection sort algorithm and how to implement it in C language.
What is Selection Sort?
The main idea behind this sorting algorithm is to scan the unsorted part of the array repeatedly to find the smallest element in it and placing it at the beginning of this unsorted array.
You have to Selec...
In this article I'm gonna talk about Bubble Sort Algorithm. It is one of the simplest Sorting Algorithms there exists for sorting.
Let's get started!
What is Bubble Sort?
Bubble sort is a sorting technique which compares and swaps(if needed) each pair of adjacent elements present in an array repeatedly until all the adjacent ele...
Sorting means to arrange a group of things in a specific order. Algorithms that help us sort a group of items are called Sorting Algorithms.
In this article I'm gonna give a brief introduction about Sorting Algorithms and its various types that you might come across.
What are Sorting Algorithms?
They're nothing but just a way to...
Linear Search and Binary Search are two popular searching algorithms. In this article, we'll be comparing the two algorithms in order to find out which algorithm is better based on their applications.
Everyday we come across various situations wherein we find ourselves searching for things. Similarly, a computer alwa...
Previously, we briefly discussed about time complexity of algorithms. You can check it out here if you haven't yet.
In this post we'll learn about the concept of time complexity in a more detailed way. A mathematical way of representing the time complexity of an algorithm. It's definitely gonna include some uncomfortable looking...
The time complexity of an algorithm is the time taken by an algorithm to run.
Sometimes, when we try to solve a problem, we might think of more than one way to solve it. Now some of these approaches might take less time to come to the solution while the others might take more time.
The approach that takes the le...
Binary Searching algorithm is used to search for an element in a sorted array. It involves dividing an array into halves until the element is finally found.
I've already given a brief introduction of this algorithm in one of my previous posts. You can find it here if you haven't read that yet.
So let's get started with the algor...
In this article I'm gonna be talking about the mechanism of Linear Search Algorithm and how you can implement it in C.
I've already given you a brief introduction of this algorithm in my previous article. You can check it out here.
So, summing it all up - the Linear Search Algorithm is basically checking each element of an array...
Searching algorithms are designed to locate the position of an element (if present) in a data structure.
To search for an element in a linear data structure like an array, we can use many different types of searching algorithms. Here we're gonna talk about two most important searching methods - Linear Search and Binary Search....
So far we've discussed about how we can perform certain operations on a Binary Search Tree. It is no fun to learn about new stuff when you don't know where exactly you can use it. So, In this article I'm gonna be talking about the applications of Binary Tree Data Structure.
But first, lets find the answer to a simple question :...
In this article I'm gonna talk about how we can find the k'th maximum element in a given Binary Search Tree.
Previously we talked about the methods of finding the k'th minimum element in a BST. If you haven't read that yet, please check it out here because we're gonna use the similar concepts here.
In k'th minimum element search...
So far we've discussed about insertion, deletion and searching operations in a Binary Search Tree. If you haven't read them yet, you can check them out here.
In this post I'm gonna talk about how you can find the K'th - Minimum element in a Binary Search Tree.
So, let's start!
What is meant by the "K'th minimum element"...
In this post I'm gonna be talking about deletion of a node in Binary Search Tree.
There can be three scenarios for deletion of a node in a Binary Search Tree.
Let's first discuss the three scenarios.
The three situations of deletion
1. Node to be deleted is a leaf node
It has the easiest deletion procedure.
When you want to del...
In this post, I'm gonna be talking about how we can search for an element in a Binary Search Tree.
It is very easy to search for an element in a Binary Search Tree, easier than even in an array.
All you have to do is compare the element's value with the value you're searching for at each level until you reach the targeted elemen...
In this article I'm gonna talk about the ways of traversal we can perform on Binary Trees.
A node of a binary tree primarily consists of three components -
it's own data (D)
It's left child (L)
It's right child (R)
Consider a node to be the most basic unit of a binary tree. Then the traversal methods that can be performed on...
A Binary Search Tree is a Tree in which each node has not more than two child nodes, and each of the child nodes are inserted in the tree based on a certain rule - the left child should have value less than the parent node and the right child should have the value greater than the parent node.
A good example for a Binary Search...
Binary trees are a type of Tree data structure wherein each node has at-most 2 child nodes.
We've already discussed about Tree data structure. So, in this article we're gonna talk about the implementation of Binary Trees in C.
This is how a Binary Tree looks like. As you can see here, no node has more than 2 child nodes.
A Tree is a non linear data structure. Unlike the data structures that we've learned so far like - Linked Lists, Stacks, Queues, etc. In this type of data structure, one element can be linked to more than one element.
Tree data structure, just like the other data structures we've learned so far, is an example of abstract data ty...
Till now we've come across many different types of data structures. In this article I'm gonna be talking about a concept called Abstract Data Type.
Primitive Data Types
But before getting started with that, let's first talk about what we exactly mean by "Data types".
So, here's the definition for you - A data type of a...
Till now we've talked about linked lists and the basic operations associated with it. But today we're gonna talk about linked lists only, but with a slight variation.
In a linked list, traversal can be done one way(a node only had "next" component associated with it), in a doubly linked list, traversal can be done both...
A queue is a linear data structure which follows FIFO principle in deletion and insertion operations.
In real sense queue is just a sequence of objects(people, vehicles, etc.) waiting for their turn to come.
For instance, it could be a queue of people waiting for their turn to come to buy tickets for a movie show, it could be a...
In this article, we're gonna talk about stack implementation using linked lists. In my past few posts I've already talked about Linked list implementation and stacks. If you're not yet clear with those concepts, please check out the above links!
So let me give you a quick recap, a linked list is a dynamic linear data structure....
A stack is a linear data structure in which operations can be done in a specific order. Stacks follow the LIFO (Last In First Out) Principle.
I'm sure you might've heard of a stack of different things like a stack of papers or a stack of books. The stack data structure is exactly the same thing.
The operations on a stack like -...
In this post, I'm gonna be talking about circular linked lists.
To learn the basics of a linked lists you can check out my other posts here.
So let's get started!
So what exactly do we mean by a linked list?
A circular linked list is a normal linked list but with its head and last element connected.
The code is ver...
In this article, I'm gonna be talking about Applications of linked lists.
Now that we've come so far and learned all the basics of a singly linked list, it's only natural to wonder what could be the use of a linked list in the real world.
Let's start off with this gif -
Does it remind you of something?
The minions have formed s...
In this blog I'm gonna be talking about the deletion operations in linked lists.
Just like how there are three insertion operations in a linked list, there are three deletion operations. All the three deletion methods are just the reverse of what we do in insertion operations.
The three types of Node Deletion
1. Delete node from...
Now that we've learned how the basic operations on a linked list are done let's look at the different types of insertion in a linked list. There are three ways of node insertion in a linked list.
The Three Ways of Node Insertion
We can insert a node in the following ways:
1.Insertion from the front end
The front-most node of a l...