Written by Kousik :
This is another efficient way of solving
a problem related with sorting. This algorithm works as the way people play
cards. We present our procedure for insertion sort by the name INSERTION. This
function takes an array of n element as input which is to be sorted. This
algorithm sorts given n elements by inserting them into their right position.
Procedure INSERTION
{
For i=1 to n-1 do
Insert(i);
...
Thursday, 3 October 2013
Written by Kousik :
“Sorting”, this word must
come when you are reading C programming language as well as algorithm. This is
important part of C programming and very interested problem. Many algorithms
for sorting are there. In this section we discuss about several sorting
algorithms and their time and space complexity.
Definition:
Input: A sequence of n numbers from
linearly ordered set or totally ordered set.
Output: A permutation...
Wednesday, 18 September 2013
#include<stdio.h>#include<stdlib.h>int *a;void m_sort(int,int);void sort(int,int,int);main(){ int n,i; printf("Enter the number of elements (it should be power of 2) "); scanf("%d",&n); a=(int *)calloc(n,sizeof(int)); printf("Enter the values "); for(i=0;i<n;i++) scanf("%d",a+i); m_sort(0,n-1); printf("The sorted array is \n"); for(i=0;i<n;i++) printf("%d ",a[i]); ...
Tuesday, 17 September 2013
Written by Wyes
#include<stdio.h>#include<stdlib.h>int *a;void quicksort(int,int);int partition(int,int);void swap_w(int,int);int random_partition(int,int);int random_number(int,int);main(){ int i,j,n; printf("Enter the number of elements "); scanf("%d",&n); a=(int *)calloc(n,sizeof(int)); printf("Enter the elements\n"); for(i=0;i<n;i++) scanf("%d",a+i); quicksort(0,n-1); ...
Written by Kousik
/* c program for bubble sort*/#include<stdio.h>int a[20];void bubble(int n){ int t, i,j; for(j=n-1;j>0;j++) { for(i=0;i<j;i++) { if(a[i+1]>a[i]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; } } }}int main(){ int n,i; printf("Enter the total number of elements: "); scanf("%d",&n); printf("Enter the values: "); ...
Monday, 12 August 2013
Written by Kousik :
Every programming language has a grammar. Different programming language has different grammar. So to learn C programming language we have to be familiar with that grammar which is related to C program. The grammar is nothing but CONSTANTS, VARIABLES, & their DATA TYPES.
CONSTANTS:
There are two types of C constants. One is PRIMARY and other is SECONDARY.
Primary constants are of three types.
1)
Integer...
Sunday, 28 July 2013
Written by Saikat :
DIVIDE AND CONQUER ALGORITHM:
The most commonly used & convenient algorithm is the 'Divide & conquer' algorithm. If a problem is tough to solve, then we can assume that this problem is made up by some small problems. Then we can break the main problem in some small sub-problems. Now we can easily solve the sub-problems. By this we can solve the whole problem very easily. This method is called Divide and...
Thursday, 25 July 2013
Posted by Kousik
This is a program to calculate your
age.
/*AGE CALCULATE*/
#include<stdio.h>
int main()
{
int dd,dm,dy,cd,cm,cy,d,m,y;
printf(“Enter your DATE OF
BIRTH in dd mm yyyy format\n”);
scanf(“%d %d %d”,&dd,&dm,&dy);
printf(“Enter Current Date in
dd mm yyyy format\n”);
scanf(“%d %d %d”,&cd,&cm,&cy);
y=cy-dy;
if(dm>cm)
{
y--;
m=12-(dm-cm);
if(dd>cd)
{
m--;
d=30-(dd-cd);
}
else
{
d=cd-dd;
}
}
else
{
m=cm-dm;
if(dd>cd)
{
m--;
d=30-(dd-cd);
}
else
{
d=cd-dd;
}
printf(“You...
Friday, 17 May 2013
This is a program to convert binary to decimal
/* author- WYES KARNY */
#include<stdio.h>
int main()
{
int a,rem,des=0,i=1;
printf("Enter a binary number ");
scanf("%d",&a);
while(1)
{
rem=a%10;
a=a/10;
des+=rem*i;
i=i*2;
if(a==0)
break;
}
printf("\nThe equevalent desimal value is %d \n",des);
return 0;
}
And for the Decimal to binary
#include<stdio.h>int main(){ int a,i,shift,bit; scanf("%d",&a); for(i=0;i<16;i++)...
Friday, 10 May 2013

Linked List is collection of data which is linked together in a specific way.
It is very efficient for computer memory. It consumes memory usage and save memory spaces.
It works as Dynamic Allocation System (DMA).
First we have to know -
What is Linked List?
Why we use Linked List?
How do we implement Linked list?
We...
Subscribe to:
Posts (Atom)