منتدى تكنولوجيا المعلومات
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

منتدى تكنولوجيا المعلومات

جامعة مؤته
 
الرئيسيةأحدث الصورالتسجيلدخول
بحـث
 
 

نتائج البحث
 
Rechercher بحث متقدم
تصويت
هل يمكن للروبوت أن يحل محل الإنسان بشكل كامل في أمور حياته اليومية ؟
نعم
هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_rcap14%هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_lcap
 14% [ 2 ]
لا
هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_rcap36%هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_lcap
 36% [ 5 ]
مجرد اداة مساعدة
هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_rcap50%هنا برامج الداتاستركشر(list - stack - queue ) كاملة I_vote_lcap
 50% [ 7 ]
مجموع عدد الأصوات : 14
مواقع تهم طالب الحاسوب
www.islamonline.net
ساعة المنتدى
ترجم ما يصعب عليك

 

 هنا برامج الداتاستركشر(list - stack - queue ) كاملة

اذهب الى الأسفل 
5 مشترك
كاتب الموضوعرسالة
محمد قاسم المولجي
نجم جديد
نجم جديد
محمد قاسم المولجي


ذكر عدد الرسائل : 7
العمر : 37
التخصص : انظمة معلومات حاسوبية
تاريخ التسجيل : 29/07/2008

هنا برامج الداتاستركشر(list - stack - queue ) كاملة Empty
مُساهمةموضوع: هنا برامج الداتاستركشر(list - stack - queue ) كاملة   هنا برامج الداتاستركشر(list - stack - queue ) كاملة Icon_minitimeالإثنين ديسمبر 15, 2008 7:09 am

السلام عليكم ورحمة الله
اهدي طلاب الداتا ستركشر هذه المجموعة من البرامج
بمناسبة عيد الاضحى وهي برامج كاملة
unsorted list

#include
enum relation{less,equal,greater};
const int max=10;
class itemtype
{
private:
int value;
public:
relation compare(itemtype other);
void initialized(int num);
void print();
};
relation itemtype::compare(itemtype other)
{
if(valuereturn less;
else if(value>other.value)
return greater;
else
return equal;
}
void itemtype::initialized(int num)
{
value=num;
}
void itemtype::print()
{
cout<}
class unsortedtype
{
private:
int length;
itemtype lt[max];
public:
unsortedtype(){length=0;}
void insertitem(itemtype item);
bool empty(){return length==0;}
bool full(){return length==max;}
void deleteitem(itemtype item);
void search(itemtype item,bool&found);
void print();
void reset();
};
void unsortedtype::insertitem(itemtype item)
{
lt[length]=item;
length++;
}

void unsortedtype::deleteitem(itemtype item)
{
int location=0;
while(item.compare(lt[location])!=equal)
location++;
lt[location]=lt[length-1];
length--;
}

void unsortedtype::search(itemtype item,bool&found)
{int location=0;
bool moresearch=(locationfound=false;
while(moresearch&&!found)
{switch (item.compare(lt[location]))
{case less:
case greater:
location++;
moresearch=(locationbreak;
case equal:
found=true;
break;
}
}
}

void unsortedtype::print()
{
for(int z=0;zlt[z].print();
cout<}

void unsortedtype::reset()
{
length=0;
}
void main()
{
bool found;
unsortedtype a;
itemtype z;
int x,y;
do{
cout<<"1)insert\t2)delete\t3)search\t4)print \t5)reset\nchoose\n";
cin>>x;
switch(x)
{
case (1):found=false;
cout<<"insert the item that you want to insert\n";
cin>>y;
z.initialized(y);
a.search(z,found);
if(found)
cout<<"the item is inserted before\n";
else
{
if(!a.full())
{a.insertitem(z);
cout<<"the item is inserted\n";
}
else
cout<<"it's full\n";
}
break;
case (2):if(!a.empty())
{
found=false;
cout<<"insert the item that you want to delete\n";
cin>>y;
z.initialized(y);
a.search(z,found);
if(found)
{a.deleteitem(z);
cout<<"the item is deleted\n";
}
else
cout<<"the item isn't found \n";
}
else
cout<<"it's empty\n";
break;
case (3):found=false;
cout<<"insert the item that you want to search\n";
cin>>y;
z.initialized(y);
a.search(z,found);
if(found)
cout<<"the item is found\n";
else
cout<<"the item is not found\n";
break;
case (4):if(!a.empty())
a.print();
else
cout<<"no item to print\n";
break;
case (5):a.reset();
cout<<"ok the list reset is done\n";
break;
}
}
while(x>0 && x<6);
}



sorted list


#include
enum relation{less,greater,equal};
const int max=10;
class itemtype
{
private:
int value;
public:
relation compared(itemtype item);
void iniailized(int num);
void print();
};
relation itemtype::compared(itemtype item)
{
if(value>item.value)
return greater;
else if(valuereturn less;
else return equal;
}
void itemtype::iniailized(int num)
{
value=num;
}
void itemtype::print()
{
cout<}
class sorted
{
private:
int length;
itemtype info[max];
public:
sorted():length(0){}
void insert(itemtype item);
bool empty(){return length==0;}
bool full(){return length==max;}
void deleted(itemtype item);
void search(itemtype item,bool&found);
void print();
void reset();
};
void sorted::insert(itemtype item)
{
int location=0;
bool more=(locationwhile(more)
{
switch(item.compared(info[location]))
{
case less:
more=false;
break;
case greater:
location++;
more=(location break;
}
}
for(int index=length;index>location;index--)
info[index]=info[index-1];
info[location]=item;
length++;
}
void sorted::deleted(itemtype item)
{
int location=0;
while(item.compared(info[location])!=equal)
location++;
for(int index=location+1;indexinfo[index-1]=info[index];
length--;
}
void sorted::search(itemtype item,bool &found)
{int midpoint;
int first=0;
int last=length-1;
found=false;
bool more=(first<=last);
while(more&&!found)
{midpoint=(last+first)/2;
switch(item.compared(info[midpoint]))
{
case less:
last=midpoint-1;
more=(first<=last);
break;
case greater:
first=midpoint+1;
more=(first<=last);
break;
case equal:
found=true;
break;
}
}
}
void sorted::print()
{
for(int z=0;zinfo[z].print();
cout<}

void sorted::reset()
{
length=0;
}
void main()
{
bool found;
sorted list;
itemtype h;
int x,y;
do
{cout<<"Mohammed Qassim Almolijy\n1)insert\t2)delete\t3)search\t4)print \t5)reset\ninsert your choice\n";
cin>>x;
switch(x)
{
case (1):found=false;
cout<<"insert the item\n";
cin>>y;
h.iniailized(y);
list.search(h,found);
if(found)
cout<<"it's found before\n";
else
{if(!list.full())
list.insert(h);
else
cout<<"it's full\n";}
break;
case (2):if(!list.empty())
{found=false;
cout<<"insert the item that you want to delete\n";
cin>>y;
h.iniailized(y);
list.search(h,found);
if(found)
{list.deleted(h);
cout<<"it's deleted\n";}
else cout<<"the item isn't fount to delete it\n";
}
else
cout<<"it's empty\n";
break;
case (3):found=false;
cout<<"insert the item that you want to search\n";
cin>>y;
h.iniailized(y);
list.search(h,found);
if(found)
cout<<"the item is found\n";
else
cout<<"the item isn't found\n";
break;
case (4):
if(!list.empty())
list.print();
else
cout<<"no items to print\n";
break;
case (5):
list.reset();
break;
}
}
while(x>0&&x<6);
}


stack


#include
const int max=10;
class itemtype
{
private:
int value;
public:
void initialized(int num){value=num;} //all the definitions is in line
void print(){cout<};
class stacktype
{
private:
int top;
itemtype* info;
public:
stacktype():top(-1){info=new itemtype[max];}
bool full(){return (top==max);} //all the definitions is in line
bool empty(){return (top==-1);}
void push(itemtype item){top++; info[top]=item;}
void pop(){top--;}
void reset(){top=-1;}
void print(){for(int i=top;i>=0;i--)
info[i].print();
cout<};
void main()
{
int x,y;
stacktype stack;
itemtype item;
do
{
cout<<"Mohammed Qassim Almolijy\n1)push \t 2)pop \t 3)print\t4)reset\n choose\n";
cin>>x;
switch(x)
{case 1:
cout<<"push the item\n";
if(!stack.full())
{cin>>y;
item.initialized(y);
stack.push(item);
cout<<"the item is pushed\n";}
else cout<<"the stack is full\n";
break;
case 2:
if(!stack.empty())
{stack.pop();
cout<<"the top element is deleted\n";}
else cout<<"the stack is empty\n";
break;
case 3:
if(!stack.empty())
stack.print();
else cout<<"there are not any element to print\n";
break;
case 4:
stack.reset();
cout<<"the stack is made empty\n";
break;}
}
while(x>0&&x<5);
}


queue


#include
const int max=10;
class itemtype
{
private:
int value; //all the definitions is in line
public:
void initialized(int num){value=num;}
void print(){cout<};
class queue
{
private:
int front,rear;
itemtype info[max];
public: //all the definitions is in line
queue()
{front=max-1;rear=max-1;}
void enqueue(itemtype item)
{rear=(rear+1)%max;info[rear]=item;}
void dequeue(itemtype&item)
{front=(front+1)%max;item=info[front];}
bool full()
{return((rear+1)%max==front);}
bool empty()
{return (front==rear);}
void reset()
{front=rear;}
void print()
{for(int x=(front+1)%max;x<(rear+1)%max;x++)
info[x].print();
cout<};
void main()
{
itemtype i;
queue s;
int x,y;
do{cout<<"mohammed qassim almolijy\n1)add item\t2)delete item\t3)print queue\t4)make empty\t5)exit\nchoose\n";
cin>>x;
switch(x)
{
case 1:if(!s.full())
{cout<<"insert the item\n";
cin>>y;
i.initialized(y);
s.enqueue(i);}
break;
case 2:if(!s.empty())
s.dequeue(i);
else cout<<"the queue is empty\n";
break;
case 3:if(!s.empty())
s.print();
else cout<<"there are not any items\n";
break;
case 4:
s.reset();
break;
default: cout<<"exit..\n";
}
}
while (x>0&&x<5);
}

اتمنى ان تنال استحسانكم
الرجوع الى أعلى الصفحة اذهب الى الأسفل
اسراء عمر
نجم مبدع
نجم مبدع
اسراء عمر


انثى عدد الرسائل : 757
العمر : 34
التخصص : نظم معلومات حاسوبية
تاريخ التسجيل : 17/11/2008

هنا برامج الداتاستركشر(list - stack - queue ) كاملة Empty
مُساهمةموضوع: رد: هنا برامج الداتاستركشر(list - stack - queue ) كاملة   هنا برامج الداتاستركشر(list - stack - queue ) كاملة Icon_minitimeالإثنين ديسمبر 15, 2008 11:12 pm

يعطيك الف عافيه يا محمد
تقبل ارق تحياتي
الرجوع الى أعلى الصفحة اذهب الى الأسفل
زهرة النرجس
نجم جديد
نجم جديد
زهرة النرجس


انثى عدد الرسائل : 24
العمر : 33
التخصص : cs
تاريخ التسجيل : 17/11/2008

هنا برامج الداتاستركشر(list - stack - queue ) كاملة Empty
مُساهمةموضوع: رد: هنا برامج الداتاستركشر(list - stack - queue ) كاملة   هنا برامج الداتاستركشر(list - stack - queue ) كاملة Icon_minitimeالثلاثاء ديسمبر 16, 2008 11:41 am

شكرا لك اخ محمد على المساهمه الجيده وبالتوفيق دائما
الرجوع الى أعلى الصفحة اذهب الى الأسفل
salem aldahamsheh
نجم فعال
نجم فعال
salem aldahamsheh


ذكر عدد الرسائل : 252
العمر : 36
التخصص : CS
تاريخ التسجيل : 24/11/2008

هنا برامج الداتاستركشر(list - stack - queue ) كاملة Empty
مُساهمةموضوع: رد: هنا برامج الداتاستركشر(list - stack - queue ) كاملة   هنا برامج الداتاستركشر(list - stack - queue ) كاملة Icon_minitimeالخميس ديسمبر 25, 2008 10:28 am

شكرا محمد ع البرنامج
الله يعطيك الف عافيه
الرجوع الى أعلى الصفحة اذهب الى الأسفل
Designer
مصمم المنتدى
مصمم المنتدى
Designer


عدد الرسائل : 1558
العمر : 35
مدير المنتدى : 0
تاريخ التسجيل : 20/06/2008

هنا برامج الداتاستركشر(list - stack - queue ) كاملة Empty
مُساهمةموضوع: رد: هنا برامج الداتاستركشر(list - stack - queue ) كاملة   هنا برامج الداتاستركشر(list - stack - queue ) كاملة Icon_minitimeالإثنين ديسمبر 29, 2008 12:16 am

يعطيك الف عافية على المجهوووووووود الرائع والمشاركة المتميزة ننتظر المزيد من امثال هذه المساهمات وارجو تكثيفها

تحياتي
الرجوع الى أعلى الصفحة اذهب الى الأسفل
https://mutah.yoo7.com
 
هنا برامج الداتاستركشر(list - stack - queue ) كاملة
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى تكنولوجيا المعلومات :: منتدى تكنولوجيا المعلومات :: قسم التطبيق العملي (المختبرات)-
انتقل الى: