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

Recursion كيف أتتبعها؟؟

مغلق
بدأه OOPCPP في 8 فبراير 2006 · 2 رد · 825 مشاهدة · في هندسة البرمجيات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلاو عليكم ..

هذه أول مشاركة لي.... (h)

انا أدرس السي والسي++ والبرمجة عامة (خوارزميات.. مباني بيانات) دراسة ذاتية.. لهذا قد أحتاج للكثير من المساعدة..

التي أنا واثق من أنني سأجدها هنا :rolleyes:

سؤالي : عن الـ Recursion - كيف لي أن أتتبعها وأعرف نتائجها (أقصد في وقت التخطيط وليس كود البرمجة).

مثلاً : دالة تستدعي نفسها مع قيمة تنقص 1 كل مرة .. وترجع حاصل ضرب ما يرجع من الدالة نع نا يرجع من الدالة في الاستدعاء القادم ...

لنقل كمثال أوضح سلسة fibonachi

كيف أتتبع الدالة وسلوكها.... B)

#2

أحدهم رد على موضوعي لكن قبل أن أقرأ الرد ضاااااااااااااااااع !!!

رجاء منه أن يعاود الإجابة.

#3

السلام عليكم

It is difficult to track the number of calls for a recursive function, because the recursion stops based on a condition which is evaluated at runtime often based on user's input. You can only know how many times the function is called at runtime, unless you are working on a very simple recursive function

At runtime, You can know the exact number of calls for your function by logging some data in windows logs or in a log file.

for example like this

void MyFunction()
{
MyLogFile.Write("This is a function call");
//the rest of the function definition here
}

Currently microsoft are working on creating a way to track the calls for a function at runtime without exlicitly logging input to a log file, but I think it will be released with the next version of .NET

Another solution: you can use a profiler to see the time consumed inside your function at runtime, the number of porcessor cycles consumed in this function, and the number of calls to this function.

هذا الموضوع مغلق.

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