Graph representation in data structure

A graph is a non-linear data structure that consists of vertices and edges.Vertices are also known as nodes. Edges can be in order or not. An ordered pair (u, v) indicates that there is an edge from vertex u to vertex v in a directed graph. Also in directed graph (u,v) is not equal to … Read more

Graph and types of graph in Data Structure

A graph is an abstract data structure that is basically a collection of a finite set of vertices (also called nodes) and edges that connect these vertices. A Graph is also known as a non-linear data structure because we can insert data anywhere by following some defined rule anywhere. Definition We can define graph G … Read more

AVL Tree in Data Structure with explanation

An AVL tree is a self-balancing binary search tree. It was named AVL on its inventor Adelson-Velsky and Landis. There are some scenarios in the Binary search tree where complexity can go O(n) in the worst-case search. so to get search in O(log n) in worst case AVL tree is designed. Property of AVL tree … Read more

Radix sort algorithm explanation with example

Radix sort is a non-comparative sorting algorithm that sorts elements digit by digit starting from least significant digit to most significant digit. Suppose if you want to sort 10 elements in ascending order using radix sort, first sort the digit of unit place. After that sort the tenth place digit. This process will go till … Read more

Quick Sort Algorithm with explanation

Quick Sort is a very popular sorting algorithm also known as partition exchange sort. Quick sort follows divide-and-conquer strategy to sort an array elements. In this algorithm first we select the pivot element. This pivot element can be selected either the left most element or right most element. After selecting pivot element, first divide an … Read more

Bubble sorting algorithm with Bubble sort program in C

Bubble sort is a simple sorting method to sorts the array elements. In the bubble sorting technique each array element is compared to the adjacent elements of the array. If the lower index value is greater than the highest index position of the array then swap these two adjacent values to maintain ascending sorting order. … Read more

Insertion sort algorithm and program in C

Insertion Sort is one of the simplest sorting algorithms that compare each array element with new elements that we want to insert in an array. It will insert a new element when found the correct position because the array should maintain order. Let’s understand it in brief Suppose you have an array of 5 cards … Read more

Selection Sort Algorithm and Program in C

Selection sort is a sorting algorithm that has an O(n2) time complexity for all the cases like best, average, and worst case. How selection sort works How selection sort works with example Here we will sort the below array using selection sort. After First Pass In first pass at position 1 index 0, array element … Read more

Linear probing technique explanation with example

The simplest approach to resolve a collision is linear probing. In this technique, if a value is already stored at a location generated by h(k), it means collision occurred then we do a sequential search to find the empty location. Here the idea is to place a value in the next available position. Because in … Read more

Collision in Hashing and Collision resolution technique

In hashing technique, Collison is a situation when hash value of two key become similar. Suppose we want to add a new Record with key k in a hashtable, but index address H(k) is already occupied by another record. This situation is known as a collision. Example to understand the collision situation In the below … Read more