http://rapidshare.com/users/3XDUOH?byfilename=1
http://rapidshare.com/users/2L249T
http://rapidshare.com/users/F83VON
http://rapidshare.com/users/MQUWKO
Stack using one dimensional array
#include
#include
#include
void push(int a[],int *t)
{
if (*t >= 4)
printf ("Stack is full\n ");
else
{
*t = *t + 1;
printf ("Enter number ");
scanf ("%d",&a[*t]);
}
}
int pop (int a[],int *top)
{
int t = 0;
if (*top == 0)
printf ("Stack is empty \n");
else
{
t=a[*top];
*top= *top -1 ;
}
return t;
}
void prn(int a[],int top)
{
int i;
for (i=4;i>=0;i--)
if (i>top)
cout<<"0"<<<> << top="-1;" ch="0;" class="smller">Circular Queue
#include
#include
void push(int a[],int *t)
{
if (*t >= 4)
printf ("Stack is full\n ");
else
{
*t = *t + 1;
printf ("Enter number ");
scanf ("%d",&a[*t]);
}
}
int pop (int a[],int *top)
{
int t = 0;
if (*top == 0)
printf ("Stack is empty \n");
else
{
t=a[*top];
*top= *top -1 ;
}
return t;
}
void prn(int a[],int top)
{
int i;
for (i=4;i>=0;i--)
if (i>top)
cout<<"0"<
#include
#include
#include
// Declaration
int a[5];
int front=0,rear=-1;
int x;
void get ()
{
int x;
if ((rear + 1)%5 == front && rear > -1 )
{
cout << "que is full"; getch(); } else { cout << "Enter element to be added "; cin >> x;
rear = (rear + 1)%5;
// cout << t="0;" rear ="="" t =" a[front];" front ="="" front =" 0;" rear =" -1;" front =" (front" t =" front;" rear ="="" t =" (t" i="0;i<="4;i++)">;
}
// front = t;
}
void main()
{
int ch=1;
clrscr();
while (ch!=4)
{
clrscr();
cout <<>> ch;
switch(ch)
{
case 1: get();
// cout << front =" 1;" rear =" 0;" class="smller">Bubble sort
#include
#include
// Declaration
int a[5];
int front=0,rear=-1;
int x;
void get ()
{
int x;
if ((rear + 1)%5 == front && rear > -1 )
{
cout << "que is full"; getch(); } else { cout << "Enter element to be added "; cin >> x;
rear = (rear + 1)%5;
// cout << t="0;" rear ="="" t =" a[front];" front ="="" front =" 0;" rear =" -1;" front =" (front" t =" front;" rear ="="" t =" (t" i="0;i<="4;i++)">;
}
// front = t;
}
void main()
{
int ch=1;
clrscr();
while (ch!=4)
{
clrscr();
cout <<>> ch;
switch(ch)
{
case 1: get();
// cout << front =" 1;" rear =" 0;" class="smller">Bubble sort
#include
#include
#include
void main()
{
int a[50];
int i=0,t;
clrscr();
cout << "Enter data element "; cin >> t;
while(t != 666)
{
clrscr();
a = t;
cout << "Enter data element "; cin >> t;
i++;
}
i--;
t=i;
for (i=0;i<=t;i++) for (int j=i+1;j<=t;j++) if (a[j])
{
a = a[j]*a;
a[j] = a/a[j];
a = a/a[j];
}
for (i=0;i<=t;i++) cout <<> << " " ; getch(); }
#include
#include
void main()
{
int a[50];
int i=0,t;
clrscr();
cout << "Enter data element "; cin >> t;
while(t != 666)
{
clrscr();
a = t;
cout << "Enter data element "; cin >> t;
i++;
}
i--;
t=i;
for (i=0;i<=t;i++) for (int j=i+1;j<=t;j++) if (a[j])
{
a = a[j]*a;
a[j] = a/a[j];
a = a/a[j];
}
for (i=0;i<=t;i++) cout <<> << " " ; getch(); }
for more programs checkout
http://www.cs.auckland.ac.nz/software/AlgAnim/ds_ToC.html
0 comments:
Post a Comment