الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

عدت اساله لم افهمها في الجافا

بدأه بوهاجر في 19 أكتوبر 2010 · 22 رد · 1,116 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله

والله ياريت احد يساعدني فيها

1.Describe the following functions for a stack

Peek

Is empty()

Is full()

Pop()

Push

2. String x,y,z,t ;

customer.enque(“A”);

customer.enque(“d”);

customer.enque(“rr”);

x= customer .deque();

customer.enque(“wr”);

customer.enque(“bb”);

customer.enque(“cc”);

y= customer.deque();

a. What is the value of x?

b. What is the value of y?

3. Explain the concept of queue in detail with example

4. Assume that a Queue named Ticket is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue

Ticket.enque(23);

Ticket.enque(4);

Ticket.enque(34);

Ticket.enque(11);

Ticket.deque();

Ticket.deque();

Ticket.enque(15);

Ticket.enque(29);

Ticket.deque();

Ticket.enque(32);

5.Assume that there is a stack named s of size 10. See the following operations on this stack and answer the questions a to d

int x,y,z,t ;

s.push(133);

s.push(127);

x=s.pop();

s.push(33);

s.push(38);

y=s.pop();

z=s.pop();

s.push(s.pop();

t=s.pop();

a. What is the value of x?

b. What is the value of y?

c. What is the value of z?

d. What is the value of t?

11. Assume that there is a Queue named customers of size 10. See the following operations on this queue and answer the questions a to e (8)

String x,y,z,t ;

customer.enque(“Ali”);

customer.enque(“Ahmed”);

x= customer .deque();

customer.enque(“Anwar”);

customer.enque(“Bobby”);

y= customer.deque();

z= customer.deque();

t= customer.deque();

c. What is the value of x?

d. What is the value of y?

e. What is the value of z?

f. What is the value of t?

1. Assume that a Circular Queue named People is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue. (15marks)

People.enque(5);

People.enque(6);

People.enque(67);

People.enque(89);

People.deque();

People.deque();

People.enque(45);

People.enque(89);

People.deque();

People.enque(62);

2. Suppose that s and t are empty stacks. Draw the stack and explain the operation for each of the given operations. (8 marks)

s.push(a)

s.push(b)

s.push( c )

t.push(d)

t.push(s.pop())

t.push(s.peek())

s.push(t.pop())

t.pop()

3. Assume that there is a stack named s of size 10. See the following operations on this stack and answer the questions a to d ( 8 marks)

int x,y,z,t ;

s.push(23);

s.push(15);

x=s.pop();

s.push(20);

s.push(28);

y=s.pop();

z=s.pop();

s.push(s.pop();

t=s.pop();

e. What is the value of x?

f. What is the value of y?

g. What is the value of z?

h. What is the value of t?

4. Assume that there is a Queue named customers of size 10. See the following operations on this queue and answer the questions a to e

String x,y,z,t ;

customer.enque(“Jane”);

customer.enque(“Jess”);

customer.enque(“Jill”);

x= customer .deque();

customer.enque(“Jimr”);

y= customer.deque();

customer.enque(“Bobby”);

z= customer.deque();

t= customer.deque();

g. What is the value of x?

h. What is the value of y?

i. What is the value of z?

j. What is the value of t?

5. Assume that a Circular Queue named People is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue

People.enque(“Ali”);

People.enque(“Anwar”);

People.enque(“Bashar”);

People.enque(“Sami”);

People.deque();

People.deque();

People.enque(“Risha”);

People.enque(“Jose”);

People.deque();

People.enque(“Bader”);

#2

هذا واجب ويمنع وضح مثل هذه الاشياء

برجاء وضع محاولاتك كى لا يتم اغلاقه من قبل المشرفين

Software Developer
Mahmoudkelany.com


 

#3

والله اخوي للاسف ماحضرت اخر 3 دروس وكلش مب عارف احل وله شي

ياريت احد يساعدني او يشرح لي

#4
اقتباس
Is empty()

هذه الدالة تقوم بعمل check على ال stack هل هو ممتلىء ام لا

و اذا كان غيرممتلىء تقوم بأرجاع قيمة boolean اى تكون true or false

اقتباس
Is full()

عكس الدالة السابقة

اقتباس
Pop()

هذه الدالة تقوم بسحب عنصر واحد من ال stack

اقتباس
Push

iهذه الدالة تقوم بأدخال عنصر واحد الى ال stack

اقتباس
2. String x,y,z,t ;

customer.enque(“A”);

customer.enque(“d”);

customer.enque(“rr”);

x= customer .deque();

customer.enque(“wr”);

customer.enque(“bb”);

customer.enque(“cc”);

y= customer.deque();

a. What is the value of x?

b. What is the value of y?

هل تعلم ما هو الqueue ؟

عامة نقوم بادخال العناصر فيه مثل الطابور اى العنصر الذى يدخل اولا هو الذى يخرج اولا

عكس ال stack حيث ان فى ال stack العنصر الذى يدخل اولا يخرج اخر عنصر...و العنصر الاخير هو الذى يخرج اول عنصر

و يوجد فى ال queue دالتان هما enqueue و dequeue الاولى خاصة بادخال العناصر و الثانية خاصة بسحب العناصر و اخراجها

اذا فى هذا السؤال قمنا بأدخال A ثم d ثم rr لاحظ ان A هو العنصر الذى دخل اولا

اذا عند السحب سيكون هو العنصر الذى يخرج اولا و بالترتيب

عند تنفيذ هذا السطر

x= customer .deque();

يعنى اننا سنقوم بسحب عنصر

اذا ستكون قيمة ال x تساوى A

و اذا قمنا بتكرار هذا السطر ستكون قيمة ال x تساوى d ثم rr

قيمة ال y قم باستنتاجها انت.........

.

اقتباس
Explain the concept of queue in detail with example

قمت بتوضيحه قليلا....واصل البحث و القراءة و قم بكتابة هذا السؤال لوحدك

هكمل.................

تم تعديل هذه المشاركة بواسطة نفرتاري في 19 أكتوبر 2010 في 19:12

00020309t.gif

1958_1963.gif
#5

اخى الكريم

هذا موضوع عن الـ queue , stack

كنت قد اقتبسته من موقع ما

ناس كانوا معطيونى اياه

ولكنه بالسى بلس بلس وشرح عربى وهيفهمك طريقه العمل

يمكنك الاطلاع عليه

http://www.forums.fci4all.com/index.php?showtopic=17946

بالتوفيق :)

Software Developer
Mahmoudkelany.com


 

#6

اضافه

الاخت نفرتاي وضحت لك توضيح يسهل عليك فهمه

و ربما تسأل لماذا انا وضعت تلك الرابط مع انه بالسى بلس بلس

الكود غير مهم

الاهم ان به شرح لكل ما تريده

انما الكود عندما تفهم الشرح العام يمكنك بعدها تنفيذه باللغه التى تحتاجها

بالتوفيق

Software Developer
Mahmoudkelany.com


 

#7
اقتباس
4. Assume that a Queue named Ticket is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue

Ticket.enque(23);

Ticket.enque(4);

Ticket.enque(34);

Ticket.enque(11);

Ticket.deque();

Ticket.deque();

Ticket.enque(15);

Ticket.enque(29);

Ticket.deque();

Ticket.enque(32);

لاحظ الصور جدااااا........

و الللون الاحمر يشير الى ال front و الاخضر يشير الى ال rear

لاحظ ان حجم ال queue يساوى 5

بعد تنفيذ هذه السطور يصبح شكل ال queue هكذا

Ticket.enque(23);
Ticket.enque(4);
Ticket.enque(34);
Ticket.enque(11);

post-210352-043377000 1287506017_thumb.p

و بعد تنفيذ هذا

Ticket.deque();
Ticket.deque();

يكون شكل ال queue

post-210352-020948800 1287506099_thumb.p

ثم نقوم بعملية ادخال مرة اخرى عن طريق هذه السطور

Ticket.enque(15);
Ticket.enque(29);

و يكون الشكل

post-210352-021516700 1287506177_thumb.p

و نقوم بعمل سحب

Ticket.deque();

و يكون الشكل

post-210352-013344600 1287506229_thumb.p

ثم نقوم بعمليه اخيرة و هى عملية ادخال

Ticket.enque(32);

و يكون الشكل النهائى لل queue

post-210352-072724900 1287506291_thumb.p

المرفقات
h1.pngh2.pngh3.pngh4.pngh5.png
00020309t.gif

1958_1963.gif
#8

تستطيع الاجابة على الاسئلة التى على ال Queue بمفردك

00020309t.gif

1958_1963.gif
#9

طيب هنا

2. String x,y,z,t ;

customer.enque(“A”);

customer.enque(“d”);

customer.enque(“rr”);

x= customer .deque();

customer.enque(“wr”);

customer.enque(“bb”);

customer.enque(“cc”);

y= customer.deque();

a. What is the value of x?

b. What is the value of y?

قبمت ال y = d

او

y = wr

?

#10

قيمة ال y تساوى d

00020309t.gif

1958_1963.gif
#11

طيب و

5

.Assume that there is a stack named s of size 10. See the following operations on this stack and answer the questions a to d

int x,y,z,t ;

s.push(133);

s.push(127);

x=s.pop();

s.push(33);

s.push(38);

y=s.pop();

z=s.pop();

s.push(s.pop();

t=s.pop();

a. What is the value of x?

b. What is the value of y?

c. What is the value of z?

d. What is the value of t?

ياريت شرح الاني لم افهم

#12

اولا ال stack تخزن فيه البيانات كما قلت مسبقا ان العنصر الذى يدخل اولا يكون اخر عنصر يخرج

و العكس..اى ان العنصر الذى يدخل اخر يكون اول عنصر يخرج

فى السؤال حجم ال stack 10

بعد تنفيذ هذه السطور يصبح شكل ال stack هكذا

post-210352-075586800 1287512963_thumb.p

وبعد تنفيذ هذا السطر

x=s.pop();

فأننا نقوم بسحب عنصر و وضع قيمته فى x و يصبح شكل ال stack

post-210352-042043300 1287513051_thumb.p

طبعا ستكون قيمة x تساوى 127

ثم نقوم بادخال عنصرين مرة اخرى عن طريق الكود:::

s.push(33);
s.push(38);

و يكون الشكل

post-210352-016863400 1287513112_thumb.p

ثم نقوم بعملية سحب و وضع القيمة فى y

y=s.pop();

و يكون الشكل

post-210352-073102700 1287513189_thumb.p

و تكون قيمة y تساوى 38

و نقوم بعملية سحب اخرى و وضع القيمة فى z

z=s.pop();

و يكون الشكل

post-210352-043966000 1287513260_thumb.p

و تكون قيمة ال z تساوى 33

و اخر سطر نقوم فيه بعمل سحب و ادخال مرة واحدة

نقوم بحسب و من ثم ندخلها مرة اخرى

s.push(s.pop();

و يكون الشكل

post-210352-052455900 1287513353_thumb.p

المرفقات
s1.pngs2.pngs3.pngs4.pngs5.pngs6.png

تم تعديل هذه المشاركة بواسطة نفرتاري في 19 أكتوبر 2010 في 21:38

00020309t.gif

1958_1963.gif
#13

بأمكانك ايجاد قيمة ال t فى هذا السؤال

و اما بخصوص بقية الاسئلة اعتقد انها متشابهة

و جميعها سهلة........

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

بالتوفيق :)

00020309t.gif

1958_1963.gif
#14

ايه الحلاوه دى اى خدمه يا عم الميس نفرتارى حلتلك الاسئله 015.gif

والله مشكوره ..

no-pain-no-gain.jpg

اذا كنت لا تعلم الى اين تذهب... فكــل الطرق تؤدى الى هناك

#15

int x,y,z,t ;

s.push(133);

s.push(127);

x=s.pop();

s.push(33);

s.push(38);

y=s.pop();

z=s.pop();

s.push(s.pop();

t=s.pop();

راح تكون الاجوبه

a. What is the value of x? 127

b. What is the value of y? 38

c. What is the value of z? 33

d. What is the value of t? 133

وفي سؤال

5. Assume that a Circular Queue named People is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue

People.enque(“Ali”);

People.enque(“Anwar”);

People.enque(“Bashar”);

People.enque(“Sami”);

People.deque();

People.deque();

People.enque(“Risha”);

People.enque(“Jose”);

People.deque();

People.enque(“Bader”);

الجواب

Ali Anwar Bashar Sami

Bashar Sami

Bashar Sami Risha Jose

Sami Risha Jose

Sami Risha Jose Bader

4. Assume that there is a Queue named customers of size 10. See the following operations on this queue and answer the questions a to e

String x,y,z,t ;

customer.enque(“Jane”);

customer.enque(“Jess”);

customer.enque(“Jill”);

x= customer .deque();

customer.enque(“Jimr”);

y= customer.deque();

customer.enque(“Bobby”);

z= customer.deque();

t= customer.deque();

g. What is the value of x? Jane

h. What is the value of y? Jess

i. What is the value of z? Jill

j. What is the value of t? Bobby

هل الاجابات صحيحه ؟

#16

السوال الثالث مظبوط

السوال الخامس

Ali	Anwar	Bashar

فقط

السوال الرابع

g.	What is the value of x?   Jane
h.	What is the value of y?   Jess
i.	What is the value of z?   Jill
j.  	What is the value of t?   Jimr

تم تعديل هذه المشاركة بواسطة Mahmoud Kelany في 19 أكتوبر 2010 في 23:10

Software Developer
Mahmoudkelany.com


 

#17

طيب وهذا الاجابات

و السوال الخامس

5. Assume that a Circular Queue named People is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue

People.enque(“Ali”);

People.enque(“Anwar”);

People.enque(“Bashar”);

People.enque(“Sami”);

People.deque();

People.deque();

People.enque(“Risha”);

People.enque(“Jose”);

People.deque();

People.enque(“Bader”);

عملتها بلخطوات

Ali Anwar Bashar Sami

بعدها People.deque();

مرتين يعني بيطلع Ali Anwar

وبتصير

Bashar Sami

ونضيف عليهم

Bashar Sami Risha Jose

وبعدها

Sami Risha Jose

وفي الاخير

Sami Risha Jose Bader

11. Assume that there is a Queue named customers of size 10. See the following operations on this queue and answer the questions a to e (8)

String x,y,z,t ;

customer.enque(“Ali”);

customer.enque(“Ahmed”);

x= customer .deque();

customer.enque(“Anwar”);

customer.enque(“Bobby”);

y= customer.deque();

z= customer.deque();

t= customer.deque();

c. What is the value of x? Ali

d. What is the value of y? Ahmed

e. What is the value of z? Anwar

f. What is the value of t? Bobby

1. Assume that a Circular Queue named People is defined of size 5. Draw the queue for all the operations given below. Mark the Front and rear of your queue. (15marks)

People.enque(5);

People.enque(6);

People.enque(67);

People.enque(89);

People.deque();

People.deque();

People.enque(45);

People.enque(89);

People.deque();

People.enque(62);

5 6 67 89

67 89

67 89 45 89

89 45 89

89 45 89 62

3. Assume that there is a stack named s of size 10. See the following operations on this stack and answer the questions a to d ( 8 marks)

int x,y,z,t ;

s.push(23);

s.push(15);

x=s.pop();

s.push(20);

s.push(28);

y=s.pop();

z=s.pop();

s.push(s.pop();

t=s.pop();

e. What is the value of x? 15

f. What is the value of y? 28

g. What is the value of z? 20

h. What is the value of t? 23

#18

وين الجماعه :unsure:

#19

للرفع مره اخرى :ohmy:

#20

اجابة السؤال ال 11 صحيحة

قيمة ال t صحيحة

بالنسبة للسؤال الخامس عن ال Circular Queue معلوماتى ليست قوية عنه

لكن سأرجع معلوماتى قليلا و سارد عليك

بالتوفيق

00020309t.gif

1958_1963.gif
#21

'طيب السؤال ال 11 صح و الباقي ؟ و السؤال ال 5 ؟

#22

و الباقى صح.......لكن الخامس هراجع معلوماتى فقط و ارد عليك

00020309t.gif

1958_1963.gif
#23
5. Assume that a Circular Queue named People  is  defined of size 5.  Draw the queue for all the operations given below.  Mark the Front and rear of your queue

People.enque("Ali");
People.enque("Anwar");
People.enque("Bashar");
People.enque("Sami");
People.deque();
People.deque();
People.enque("Risha");
People.enque("Jose");
People.deque();
People.enque("Bader");

مش دا حضرتك الكود هيتنفذ مره واحده

اول حاجه هيدخل فى الطابور

تعالى ناخد امر امر

اول امر

People.enque("Ali");

بقا الطابور كدا

post-217802-068987600 1287599062_thumb.p

تانى امر

 People.enque("Anwar");

post-217802-014466400 1287599064_thumb.p

تالت امر

People.enque("Bashar");

post-217802-087007800 1287599065_thumb.p

رابع امر

People.enque("Sami");

post-217802-043055300 1287599067_thumb.p

خامس امر

People.deque();

اللى هيخرج هيكون Ali

وهيكون الطابور كدا

post-217802-041895600 1287599069_thumb.p

سادس امر

People.deque();

اللى هيخرج هيكون Anwar

post-217802-095982700 1287599070_thumb.p

سابع اامر

 People.enque("Risha");

هيضيف فى اخر الطابور

post-217802-049603200 1287599072_thumb.p

ثامن امر

People.enque("Jose");

هيضيف فى اخر الطابور

post-217802-001511500 1287599074_thumb.p

تاسع امر

 People.deque();

هيخرج Basher

post-217802-047732500 1287599077_thumb.p

عاشر امر

People.enque("Bader");

هيضيف Bader فى اخر الطابور

وهذا اخر امر

وهيكون نهايه الطابور هكذا

post-217802-009422900 1287599079_thumb.p

بالتوفيق :)

المرفقات
1.png2.png3.png4.png5.png6.png7.png8.png9.png10.png

Software Developer
Mahmoudkelany.com


 

مواضيع مشابهة