# Tutorials

## Kruskal’s Algorithm in C [Program & Algorithm]

This tutorial is about kruskal’s algorithm in C.   It is an algorithm for finding the minimum cost spanning tree of the given graph. In kruskal’s algorithm, edges are added to the spanning tree in increasing order of cost. If the edge E forms a cycle in the spanning, it is discarded.   Also Read: Prim’s Algorithm in C …

## What are B-Trees?

B-tree is another very popular search tree. The node in a binary tree like AVL tree contains only one record. AVL tree is commonly stored in primary memory. In database application, where huge volume of data is handled, the search tree cannot be accommodated in primary memory. B-trees are primarily meant for secondary storage. A …

## C Program to print its own Source Code as Output

We can print the source code of a program as an output using quine. So first lets understand what quine is? What is a Quine? A quine is a computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in …

Adjacency Matrix A graph G = (V, E) where v= {0, 1, 2, . . . n-1} can be represented using two dimensional integer array of size n x n. int adj[20][20] can be used to store a graph with 20 vertices adj[i][j] = 1, indicates presence of edge between two vertices i and j. …

## What is Josephus Problem?

This is an interesting programming problem know in the literature as Josephus problem. The problem is given as: 1. Suppose there are n children standing in a queue. 2. Students are numbered from 1 to n in the clockwise direction. 3. Students choose a lucky number say m. They start counting in clockwise direction from …

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

## How to Swap Two Numbers Without Using Temporary Variable or Arithmetic Operators?

You have done swapping of two numbers using temporary variable or by using arithmetic operators. It can be done in following way. Lets take two numbers a=5 and b=7. Using Temporary Variable temp=a;            //temp becomes 5 a=b;                 //a becomes 7 b=temp;            //b becomes 5 Also Read: C++ program to swap two numbers using pointers Also Read: C++ …