# DSA

## What is Disjoint-set Data Structure?

It is a data structure to keep a record of set of elements that are partitioned into number of disjoint subsets. Such type of data structure performs three basic operations: 1. MakeSet operation 2. Find operation 3. Union operation Sometimes, it is called Union-Find data structure or Merge-Find data structure. Applications Applications It is used …

## How to Convert a Recursive Function or Algorithm to Non-Recursive?

Any recursive function can be converted to non-recursive function through use of a stack as explained below. A recursive call is similar to a call to another function. Any call to a function requires that the function has storage area where it can store its local variables and actual parameters. Return address must be saved …

## C Program for Tower of Hanoi Problem Using Recursion

Here you will get C program for tower of hanoi problem using recursion. The Tower of Hanoi (also called the Tower of Brahma or Lucas’ Tower and sometimes pluralized) is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The …

## Graphs: Introduction and Terminology

1. Introduction A graph (G) is a set of vertices (V) and set of edges (E). The set V is a finite, nonempty set of vertices. The set E is a set of pair of vertices representing edges. G= (V, E) V (G) = Vertices of graph G E (G) = Edges of graph G …

## Program for Heap Sort in C

Here you will get program for heap sort in C. It is a comparison based sorting technique which uses binary heap data structure. Below I have shared simple program to implement this sorting technique in C. Program for Heap Sort in C #include<stdio.h> void create(int []); void down_adjust(int [],int); void main() { int heap[30],n,i,last,temp; printf(“Enter …

## Program for Stack in C [Push, Pop, Display]

Here you will get the program for stack implementation using array in C language. What is Stack? Stack is a LIFO (last in first out) structure. It is an ordered list of the same type of elements. A stack is a linear list where all insertions and deletions are permitted only at one end of …

## Binary Tree in C Using Recursion

Here you will get program to create binary tree in C using recursion. What is Binary Tree? A tree is said to be a binary tree if each node of the tree can have maximum of two children. Children of a node of binary tree are ordered. One child is called left child and the …

## Linear Queue in C++ using Linked List

Here you will learn about linear queue in C++. What is Queue? The queue is a linear data structure where operations of insertion and deletion are performed at separate ends that are known as front and rear. The queue follows FIFO (First in First Out) concept. First element added to the queue will be first one to be …