Friday, April 17, 2009

DOUBLE LINKED LIST

#include
#include
#include
#include
struct node
{
int data;
struct node *ptr;
};
typedef struct node NODE;
NODE *first=NULL,*last=NULL;
NODE *nn,*temp,*temp1,*temp2;
main()
{
int ch,r=1;
clrscr();
while(r)
{
printf("enter the choice\n");
printf("1.entering from the front\n");
printf("2.entering from the end\n");
printf("3.deleting from the front\n");
printf("4.deleting from the end\n");
printf("5.display\n");
printf("6.exit\n");
scanf("%d",&ch);
switch(ch)
{
case 1:enterf();
break;
case 2: entere();
break;
case 3:delf();
break;
case 4:dele();
break;
case 5:display();
break;
case 6:return;
}
printf("do you want to continue press 1 for yes and 0 for no\n");
scanf("%d",&r);
}
}
enterf()
{
int item;
nn=(NODE*)malloc(sizeof(NODE));
printf("enter the item to be inserted\n");
scanf("%d",&item);
nn->data=item;
nn->ptr=nn;
if(first==NULL)
{
first=last=nn;
}
else
{
last->ptr=nn;
nn->ptr=first;
first=nn;
}
}

display()
{
if(first==NULL)
printf("empty list\n");
else if(first->ptr==first)
printf("%d->",first->data);
else
{
temp=first;
while(temp!=last)
{
printf("%d->",temp->data);
temp=temp->ptr;
}
printf("%d->",last->data);
}
}

entere()
{
int item;
nn=(NODE*)malloc(sizeof(NODE));
printf("enter the item to be inserted\n");
scanf("%d",&item);
nn->data=item;
nn->ptr=nn;
if(first ==NULL)
{
first=last=nn;
}
else
{
last->ptr=nn;
nn->ptr=first;
last=nn;
}
}
delf()
{
if(first==NULL)
printf("empty list\n");
else if(first->ptr==first)
{
printf("deleted element =%d",first->data);
free(first);
first=last=NULL;
}
else
{
temp=first;
first=first->ptr;
printf("deleted element=%d",temp->data);
free(temp);
last->ptr=first;
}
}
dele()
{
if(first==NULL)
printf("empty list\n");
else if(last->ptr==last)
{
printf("deleted element=%d",first->data);
free(first);
first=last=NULL;
}
else
{
temp1=first;
while(temp1->ptr!=last)
{
temp1=temp1->ptr;
}
printf("deleted element=%d",last->data);
free(last);
last=temp1;
last->ptr=first;
}
}

USING CQUEUE

#include
#include
#define max 5
int front=-1,rear=-1;
int cq[max];
void main()
{
int rpt=1;
int ch;
clrscr();
while(rpt)
{
printf("1.cqinsert\n");
printf("2.cqdelete\n");
printf("3.cqdisplay\n");
printf("4.exit\n");
printf("enter your choice\n");
scanf("%d",&ch);
switch(ch)
{
case 1:cqinsert();
break;
case 2:cqdelete();
break;
case 3:cqdisplay();
break;
case 4:return;
}
printf("Do you want to continue press 1 for yes and 0 for no\n");
scanf("%d",&rpt);
}
}

cqinsert()
{
int num;
if(front==(rear+1)%max)
{
printf("queue is full\n");
return;
}
else
{
printf("enter the element\n");
scanf("%d",&num);
rear=rear+1%max;
cq[rear]=num;
if(front==-1)
front=0;
}
}

cqdelete()
{
int num;
if(front==-1)
{
printf("queue is empty\n");
return;
}
else
{
num=cq[front];
printf("Deleted number is %d",num);
if(front==rear)
front=rear=-1;
else
front=(front+1)%max;
}
}

cqdisplay()
{
int i;
if(front==-1)
{
printf("queue is empty\n");
return;
}
else if(front {
for(i=front;i<=rear;i++)
printf("%d\n",cq[i]);
}
else
{
for(i=front;i printf("%d\n",cq[i]);
for(i=0;i<=rear;i++)
printf("%d\n",cq[i]);
}
}

COMPLEX NUMBERS

#include
void main()
{
int i,a[10],rem,bin=0,base=1,num,j,k,l;
clrscr();
printf(" enter any number\n");
scanf("%d",&num);
i=0;
while(num>0)
{
rem=num%2;
bin=bin+rem*base;
base=base*10;
num=num/2;
a[i]=rem;
i++;
l=j=i;
}

for(i--;i>=0;i--)
printf("%d",a[i]);
for(j--;j>=0;j--)
{
if(a[j]==0a[j]==1)
continue;
else if(a[j]==0)
a[j]=1;
else
a[j]=0;
}
printf("The 2's complement of the given number %d is",num);
for(l--;l>=0;l--)
printf("%d",a[l]);
getch();
}

C-PROGRAMS/CIRCLE LINKED LIST

#include
#include
#include
#include
struct node
{
int data;
struct node *ptr;
};
typedef struct node NODE;
NODE *first=NULL,*last=NULL;
NODE *nn,*temp,*temp1,*temp2;
main()
{
int ch,r=1;
clrscr();
while(r)
{
printf("enter the choice\n");
printf("1.entering from the front\n");
printf("2.entering from the end\n");
printf("3.deleting from the front\n");
printf("4.deleting from the end\n");
printf("5.display\n");
printf("6.exit\n");
scanf("%d",&ch);
switch(ch)
{
case 1:enterf();
break;
case 2: entere();
break;
case 3:delf();
break;
case 4:dele();
break;
case 5:display();
break;
case 6:return;
}
printf("do you want to continue press 1 for yes and 0 for no\n");
scanf("%d",&r);
}
}

Friday, March 20, 2009

FRESHERS PARTY #############


Waitin 4r dis day 4rm many daysssssssssssssssssssssssssssss.so frns letz rock dis ocassion with gr8 ecstacy .

place : TOUCH,banjara hills,road no .3
date: 22/3/09

Wednesday, March 18, 2009

Wednesday, February 18, 2009

GOT ANOTHER DAY . . . . .. . .

frns!!! our 2nd internls which were scheduled frm 23rd feb are postponed to 24rth feb .23rd feb is declared as an holiday on da eve of MAHA SHIVARATHRI . so frns got an extra day 4r prep..time table will be da same

Monday, February 16, 2009

PROMETHEAN '09

frns our technical fest promethean was scheduled from 12th-14th march



for further details - - -- http://www.promethean09.org/