Category Archives: Tutorials

What are B+ Trees?

B+ tree is a variation of B-tree data structure. In a B+ tree, data pointers are stored only at the leaf nodes of the tree. In a B+ tree structure of a leaf node differ from the structure of internal nodes. The leaf nodes have an entry for every value of the search field, along… Read More »

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… Read More »

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… Read More »

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… Read More »

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 can be used to store a graph with 20 vertices adj[i][j] = 1, indicates presence of edge between two vertices i and j.… Read More »

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… Read More »

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… Read More »

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… Read More »