## Minimal Spanning Trees and Kruskal’s Algorithm

Given a weighted graph G, it is often desired to generate a spanning tree such that the sum of the weights of the tree edges...

Skip to content
##
Technology Articles Blog

#
Category: C

##
Minimal Spanning Trees and Kruskal’s Algorithm

##
Depth First and Breadth First Traversal

##
Graph Traversals and Spanning Forests

##
Linked representation of Graphs in C

##
Implementing Ford Fulkerson’s Algorithm in C To Maximize Network Flow

##
Implementation of Warshal’s Algorithm in C to find Path Matrices of a Graph

##
Representing Graphs and Networks in C

##
Merge and Radix Sorts

##
Insertion Sort and its implementation in C

##
Heap Tree Sort and its implementation in C

##
Binary Tree Sort in C

##
Selection Sort

##
Bubble Sort in C

##
Efficiency and Order of a Sorting Program

##
Recursive C program for Towers of Hanoi

##
Efficiency of Recursion

##
Recursion in C

##
Doubly Linked Lists

##
Simulation of Josephus Problem using Circular lists

##
Dynamic Circular Linked Lists in C

##
Advantages of Dynamic representation of Lists over its Array implementation

##
Dynamic Linked Lists as Queues in C

##
Implementing Dynamic Linked Lists in C

##
Queues and its implementation in C

##
Game Trees

##
Representing Lists As Binary Trees in C

##
HUFFMAN Algorithm and its implementation in C

##
Threaded Binary Tree and its implementation in C

##
Traversing a Binary Tree in C

##
C program implementing Binary Tree Search to find duplicates of a file

##
Binary Tree representation and Primitive Operations on a Binary Tree in C

##
C program to print sum up-to each individual preceding number until the entered number

##
C program for Hailstones series

##
C program to generate random numbers in any range

##
for loops in C

##
C program to test for a prime number

##
C program to implement Russian Peasant

##
C program to find numbers whose sum of cubes of individual numbers is that number

##
C program to find circumference and area of a circle from given radius

##
While Loop in C

##
C program to find the sum of squares of first n natural numbers

##
Do – While Loops in C

##
Sample C program showing if – else constructs

##
C Program to check for leap year

##
Making decision in C program

##
Declaring variables in C language

##
C Programming Language

##
Recursive C program for Binary search

##
Recursive C program to print Fibonacci series

##
C program for finding factorial by recursion

##
Bubble sort in C

##
Tree representation in C

##
File Operation in C

##
C program to evaluate the 1st derivative of a function at any given point

##
C Program to evaluate forward difference

##
C program to convert a postfix string to prefix form

##
C program to convert a prefix string to infix form

##
Example for Preorder and Postorder traversal of a Binary tree

##
Traversing a Binary Tree in Postorder

Technology Articles Blog

Given a weighted graph G, it is often desired to generate a spanning tree such that the sum of the weights of the tree edges...

Depth first traversal of a Graph could be used to traverse a directed or un-directed graph and thus creating a spanning tree. Depth first traversal...

Connected Graph A graph is said to be connected if there is a path between any two of its nodes. Cycle A Path from a...

There are many in-inadequacies in using the Adjacency Matrix representation of Graphs. Once such inadequacy is the difficulty in adding or deleting nodes while data...

Flow Problem The main objective of a flow problem is to maximize the amount of an item being delivered from one point of a system...

Warshal’s Algorithm can be applied to find the Path Matrices and this the TRANSITIVE CLOSURE of a graph given its adj matrix. Warshal’s algorithm is...

A Graph is a data structure that consists of a set of nodes interconnected by directed or un-directed arcs. For a DIRECTED Graph, the ordered pair of nodes...

Merge Sort Merge Sort is a process of combining more than one sorted files into a single sorted file. The procedure is to divide a...

Insertion Sort is a simple implementation of the general straight selection sort. A simple routine for insertion sort can be written as below – void insertionsort(int...

Heap is an almost complete Binary Tree implemented in a sequential format such that the value at any of the nodes (nd) is >= or <=...

Binary Tree Sort uses a Binary search tree. The various steps involved in such a sort would be – Construct a binary tree with the given...

A Selection sorting technique uses a general algorithm which uses an ascending or descending priority queue. The idea would be to pre-process input array X[i] into...

Lets explain Bubble sort by illustrating tow specific examples involving steps where smaller numbers bubbles to first and when larger numbers bubbles to last. Number...

Efficiency Considerations The following are the efficiency considerations while planning for a sorting program / algorithm – Time required to code the program and the...

Towers of Hanoi problem consists of 3 pegs A, B and C. Let n denote number of disks in peg A. The objective is to...

In general cases, a non-recursive program runs more efficiently than a recursive program since a recursive program requires more execution time to enter and exit...

Recursion Recursion and Iteration are two different concepts of achieving a result by a number of repeated operations. Iteration involves use of for, while and...

Doubly Linked lists eliminates below drawbacks of circular lists – not able to traverse backward not able to delete and node given only points to...

Josephus Problem Josephus problem is that some soldiers are being surrounded by their enemies and there is only one horse to escape i.e. only one...

Circular lists eliminates same drawbacks of linear lists. In as circular list it is assumed that items are inserted at the front and the list...

Below are the advantages of Dynamic representation of Lists over its Array implementation – No advanced knowledge of number of nodes is required No memory...

When Dynamic Linked Lists are represented as Queues, the first node represents front of queue given by q.front and last node represents the rear of...

List is a type of dynamic data structure which rectifies certain drawbacks of Stacks and Queues. Lists generally uses the concept of pointers which points...

A Queue is a First In First Out (FIFO) which is an ordered collection of items which are deleted at the front end and inserted...

Game Tree is one of the applications of Binary Trees. For example the one implemented for the Tic-Tac-Toe Game. X | X | X O...

Case 1: A list could be represented as a Binary Tree with all the list elements along with their information at the leaf nodes. For...

Huffman trees are used as message encoding and message decoding trees which is the basic construct of compression and de. The specialty of Huffman tree...

Threaded Binary Trees are those in which the NULL right pointers of all nodes are THREADED to its immediate inorder successor in the Binary Tree. Such...

There are generally 3 traversal strategies for Binary Trees – INORDER, PREORDER and POSTORDER. For eg:, the inorder, preorder and postorder traversal of an expression tree...

A Binary Search is such a Binary Tree in which the info field of any of the nodes to the left of a particular node nd...

Binary Trees are one of the core data structures used in any programming language to implement complex systems. C programming language offers various binary tree...

Here is a C program which accepts an integer and prints out sum from 1 to 1, 1 to 2, 1 to 3 …… 1...

Hailstones is a sequence of numbers that could be generated from any positive number by performing a specific operation on it until it reaches 1....

Here is a C program to generate random numbers between any range of two digit numbers – #include #include main(){ int s, a, b, n,...

The ‘for’ loop is another important looping structure which could replace ‘while’ and ‘do .. while’ loops. It has a special feature that the initialization,...

Below is a C program to test for a prime number – main(){ float n, count = 0; i = 3; a; printf("\nEnter any number...

Here is a C program that I wrote years back to implement Russian Peasant method of an interesting multiplication technique – main(){ int a, b,...

Here is an implementation of while loop in C to find numbers whose sum of cubes of individual numbers is that number. You can go...

Here is a simple C program to find circumference and area of a circle from given radius – main(){ float r, pi = 3.1416, c, area;...

Like do-while loop, While loop is the most commonly used looping construct to repeat a process or calculation for a set or collection of inputs...

Here is a simple C program to find the sum of squares of first n natural numbers using do-while looping construct – main(){ int n,...

Looping constructs is an important programming language technique to repeat a process or calculation for a set or collection of inputs or storage based on...

Below are simple C programs for beginners to learn if-else decision construct. Example 1: Program to check if a number is odd or even main...

Here is a C program to check for leap year – main () { int year; printf("Please enter any year as 4 digits>> "); scanf("%d",...

Decision making is an important aspect of programming language that enables the programmer to arrive at a conclusion based on certain data processing, comparisons and conditional...

C programming language allows to define and classify data so we can use it appropriately in various parts of the program in the correct form...

C language developed at Bell lab by Dennis Ritchie on UNIX environment. UNIX was later rewritten in C. An earlier version of C is BCPL...

Below is an example Recursive C program to perform Binary – int binsearch(int low, int high, in a, X){ int mid; if(low > high){ return(-1);...

Below is an example recursive C program to return Fibonacci series for a given number – int fibonacci (int x){ if(n < 0){ printf("Invalid input");...

Here is a C program to find a factorial by recursive method – int factorial (int x ) { return ( n==0? 1: n*(fact(n-1))); }...

Simple bubble sort in C – for (i=0; i<n-1; i++){ for(j=i+1; j<n; j++){ if(x[j] < x[i]){ temp = x[j]; x[j] = x[i]; x[i] = temp;...

Below is an example to represent a Tree structure in C using struct...

Below is a simple C program to perform file operation – include <stdlib.h> main() { FILE * file_source char * file_name = (char*) malloc (sizeof...

Writing C programs for numerical differentiation is interesting and fun. Here is one that I wrote years back. Enjoy! ...

Below is a C program to evaluate forward difference and thus print a forward difference table for n function values –...

Below is sample C program to convert a postfix string to prefix form. Also included is detailed flow chart of the program and dry run...

Below is sample C program to convert a prefix string to infix form. Also included is detailed flow chart of the program and dry run...

Below is an example that I prepared for preorder and postorder traversal of a Binary Tree – enjoy!...

Below is the algorithm and C routine for traversing a Binary Tree in postorder. ...