المساعدة - البحث - قائمة الأعضاء - التقويم
نسخة كاملة: تكفون مساعدة>><<
برمجة - شبكات - كمبيوتر - منتديات الفريق العربي للبرمجة > منتديات لغات البرمجة العام > منتدى مبرمجي لغة جافا JAVA
مــــيو
>><<مساء الخير>><<

ممكن مساعدة انا ااا بورطه wacko.gif عندي اختباار بكر السبت
ومحتاجه شرح برنامج مع الرسم >><< وحل برنامجين >><<

blush.gif blush.gif ممكن بليـــــز تساعدوني
>><<---------------------
هذا السؤال الي محتاج شرح ورسم
a linked list demonstration:

public class linkedlist1demo
}
public static void main (string[]args)
}
linkedlist list = new linkedlist():
list.addtostart("apples".1):
list.addtostart("bananas".2):
list.addtostart("cantaloupe".3):
system.out.println("list has"+list.size()+"nedes");

list.outputlist():
if (list.contains("cantaloupe")

system.out.println("cantaloupe is on list ");
else
system.out.println("cantaloupe is NOT on list ");

list.deleteHeadNode();
if (list.contains("cantaloupe")

system.out.println("cantaloupe is on list ");
else
system.out.println("cantaloupe is NOT on list ");

while(list.deleteHeadNode())

system.out.println("start of list :");
list.outputlist();
system.out.println("end of list.");
{
{

---------------------------------------
وهذا السؤالين الي محتااج حل
exercise 1

writ a recursive method definition for a stsic mathod that has one parameter n of type int
and that returns the nth fibonacci number .the fibonacci numbers are f0 is 1, f1 is 1,f2 is 2, f3 is 3,f4
is 5,and in general fi+2=fi+fi+1=0,1,2,...ect

place the method in aclass that has a main that tests the method
-------------------------------------------
exercise 2
write a recursive method to calculate the factorial of n, that
is n!, for example,4!=4ْx3!,3!=3x2x1. plac the
method in aclass that has amain that tests the method.
-----------------------------
وشاااكر لكم >><< blush.gif blush.gif

MKSoft
السلام عليكم اختي //
المنتدى ليس لحل الواحبات , ولكن للمساعدة في تطوير القدرات العلمية , والمنطق ان ترينا ما انجزتييه حتى نساعدك ..
لكن لانك تقولين ان غدا عندك امتحان سأحاول المساعدة ..


كود
linkedlist list = new linkedlist():

قمننا هنا بتعريف Object من نوع LinkedList , وهذا الشيء هو نوع من الطرق التخزينية الديناميكية للذاكرة , بحيث يتم حجز عناوين في الذاكرة على حسب الحاجة , وليس مثل Arrays التي يتم حجز عدد من الأماكن التخزينية بغض النظر عن ما إذا كنا نريد ان تستخدمها أو لا .

كود
list.addtostart("apples".1):
list.addtostart("bananas".2):
list.addtostart("cantaloupe".3):

في الجمل السابقة , قمنا بعملية اضافة لهذه السلسة الديناميكية وهي LinkedList , حيث اضفنا في بداية السلسة apples وبالتحديد في اول مكان تخزيني في السلسة , وبعدها اضفنا في المكان التخزيني الثاني bananas , وهكذا الثالثة .

كود
list.outputlist():

حتى تقوم بطباعة عناصر السلسة
كود
if (list.contains("cantaloupe")

system.out.println("cantaloupe is on list ");
else
system.out.println("cantaloupe is NOT on list ");

شرط , لفحص ماإذا السلسلة تحتوي على cantaloupe , فإذا كان كذلك , يحب ان يطبع البرنامج الحملى الأولى , و إلا فليقم بطباعة الجملة الثانية .

كود
list.deleteHeadNode();

حتى يحذف العنصر الأول من السلسلة .
كود
if (list.contains("cantaloupe")
system.out.println("cantaloupe is on list ");
else
system.out.println("cantaloupe is NOT on list ");
سبق وان تم شرحها .



إقتباس

exercise 1

writ a recursive method definition for a stsic mathod that has one parameter n of type int
and that returns the nth fibonacci number .the fibonacci numbers are f0 is 1, f1 is 1,f2 is 2, f3 is 3,f4
is 5,and in general fi+2=fi+fi+1=0,1,2,...ect

كود
public int fib(int i)
{
    if(i == 0 || i == 1)
        return 1;

    else
        return fib(i-1) + fib(i-2);
}

إقتباس

exercise 2

write a recursive method to calculate the factorial of n, that
is n!, for example,4!=4ْx3!,3!=3x2x1. plac the
method in aclass that has amain that tests the method
كود
public int fact(int i)
{
    if(i == 1 || i == 2)
        return i;
    else
        return  i * fact(i-1);
}

مــــيو
مشكور اخوووي الله يوقفك ويقرج كربتك يااارب >><< بجد فرجت كربتي مشكوووور اخوي
blush.gif blush.gif

هذه "نسخة - خفيفة" من محتويات الرئيسية للإستعراض الكامل مع المزيد من الصور والخيارات الرجاء إضغط هنا.
Invision Power Board © 2001-2008 Invision Power Services, Inc.