# DSA

## 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   Output Enter no. of elements:5 Enter elements:12 8 46 23 7 Array …

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

Here you will get program for array representation of stack in C. 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 the list. …

## 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 …

## Singly Linked List in C

Here you will learn about singly linked list in C. What is Singly Linked List (SLL)? The simplest kind of linked list is a singly liked list (SLL) which has one link per node. It has two parts, one part contains data and other contains address of next node. The structure of a node in a SLL …