C Programming

Merge Sort implementation in C

Merging is the process of combining two or more sorted arrays into a third sorted array. We can use this technique to sort an array of n elements as follows. Divide the array into ā€˜n’ sub arrays of size 1 and merge adjacent pairs of sub arrays. Then we can have approximately n/2 sorted sub [...]

Circular Queue Data Structure with implementation in C

A circular queue is a Queue but a particular implementation of a queue. It is very efficient. It is also quite useful in low level code, because insertion and deletion are totally independant, which means that you don’t have to worry about an interrupt handler trying to do an insertion at the same time as [...]

Stacks Data Structure with implementation in C

One way to think about this implementation is to think of functions as being stacked on top of each other; the last one added to the stack is the first one taken off. In this way, the data structure itself enforces the proper order of calls. Conceptually, a stack is simple: a data structure that [...]

Using Files In C Programming

This is a C program on file Handling /************** File Handling *************/ void main() { FILE *file1; char c; int choice; char op; clrscr(); do { printf(“\t\tMenu\n\t1. Enter The Information\n\t2. Display The Information\n”); scanf(“%d”,&choice); switch(choice) { case 1: printf(“\n Information \n”); file1=fopen(“Handlin.doc”,”w”); while((c=getchar())!=EOF) { putc(c,file1); } fclose(file1); break; case 2: printf(“Information\n”); printf(“Result :”); file1=fopen(“Malcolm .doc”,”r”); [...]