37
Foundations of algorithms Presented By: H.Amerehie

Foundations of algorithms Presented By: H.Amerehie

  • Upload
    winka

  • View
    26

  • Download
    3

Embed Size (px)

DESCRIPTION

Foundations of algorithms Presented By: H.Amerehie. فصل دوم: روش تقسیم و غلبه ( Divide and Conquer ). 3 از 37. (Top-Down) رهیافت بالا به پایین. نکته : البته ممکن است به صورت یک روال معمولی نیز پیاده سازی شود. Presented By:H.Amerehie. 4 از 37. الگوریتم 1-1 : جستجوی دودویی. 5 - PowerPoint PPT Presentation

Citation preview

Page 1: Foundations of algorithms Presented By: H.Amerehie

Foundations of algorithms

Presented By:H.Amerehie

Page 2: Foundations of algorithms Presented By: H.Amerehie

فصل دوم:

روش تقسیم و غلبه(Divide and Conquer)

Presented By:H.Amerehie

Page 3: Foundations of algorithms Presented By: H.Amerehie

(Top-Down( رهیافت باال به پایین

Presented By:H.Amerehie

3 از

37

نکته : البته ممکن است به صورت یک روال معمولی نیز پیاده سازی شود.

Page 4: Foundations of algorithms Presented By: H.Amerehie

: جستجوی دودویی1-1الگوریتم

Presented By:H.Amerehie

4 از

37

Page 5: Foundations of algorithms Presented By: H.Amerehie

: جستجوی دودویی )رهیافت تقسیم و 1-1الگوریتم حل(

Presented By:H.Amerehie

5 از

37

Page 6: Foundations of algorithms Presented By: H.Amerehie

تحلیل پیچیدگی زمانی جستجوی دودویی در بدترین حالت

Presented By:H.Amerehie

6 از

37

Page 7: Foundations of algorithms Presented By: H.Amerehie

)Merge Sort( :مرتب سازی ادغامی1-2الگوریتم

Presented By:H.Amerehie

7 از

37

Page 8: Foundations of algorithms Presented By: H.Amerehie

)Merge Sort( :مرتب سازی ادغامی1-2الگوریتم

Presented By:H.Amerehie

8 از

37

Page 9: Foundations of algorithms Presented By: H.Amerehie

)Merge Sort( :مرتب سازی ادغامی1-2الگوریتم

Presented By:H.Amerehie

9 از

37

Page 10: Foundations of algorithms Presented By: H.Amerehie

)Merge( الگوریتم ادغام

Presented By:H.Amerehie

10 از

37

Page 11: Foundations of algorithms Presented By: H.Amerehie

V[j] با U[i]عمل اصلی : مقایسه

؛ تعداد عناصر موجود در آرایه های ورودی m و hاندازه ورودی : بهترین حالت : همه عناصر آرایه با طول کمتر ، از اولین عنصر

آرایه با طول بیشتر ، کوچکتر باشند؛ بنابراین :

B(m,h( = Min(m,h(

بدترین حالت : همه عناصر آرایه اول )به جز آخرین عنصر(، از اولین عنصر آرایه دوم، کوچکتر باشند, ولی آخرین عضو از تمام

عناصر آرایه دوم بزرگتر باشد. بنابراین :

W(m,h( = m+h-1

)Merge(تحلیل پیچیدگی زمانی الگوریتم ادغام

Presented By:H.Amerehie

11 از

37

Page 12: Foundations of algorithms Presented By: H.Amerehie

)Merge Sort( تحلیل پیچیدگی زمانی الگوریتم مرتب سازی ادغامی

Presented By:H.Amerehie

12 از

37

F(n(

Page 13: Foundations of algorithms Presented By: H.Amerehie

مرتب سازی سریع

Presented By:H.Amerehie

13 از

37

Page 14: Foundations of algorithms Presented By: H.Amerehie

مرتب سازی سریع

Presented By:H.Amerehie

14 از

37

مثال

Page 15: Foundations of algorithms Presented By: H.Amerehie

الگوریتم مرتب سازی سریع

Presented By:H.Amerehie

15 از

37

Page 16: Foundations of algorithms Presented By: H.Amerehie

الگوریتم بخش بندی

Presented By:H.Amerehie

16 از

37

Page 17: Foundations of algorithms Presented By: H.Amerehie

الگوریتم بخش بندی

Presented By:H.Amerehie

17 از

37

مثال

Page 18: Foundations of algorithms Presented By: H.Amerehie

پیچیدگی زمانی الگوریتم بخش بندی

Presented By:H.Amerehie

18 از

37

Page 19: Foundations of algorithms Presented By: H.Amerehie

پیچیدگی زمانی مرتب سازی سریع – بدترین حالت

Presented By:H.Amerehie

19 از

37

Page 20: Foundations of algorithms Presented By: H.Amerehie

پیچیدگی زمانی مرتب سازی سریع – حالت متوسط

Presented By:H.Amerehie

20 از

37

Page 21: Foundations of algorithms Presented By: H.Amerehie

الگوریتم ضرب ماتریس ها به روش استراسن

Presented By:H.Amerehie

21 از

37

Page 22: Foundations of algorithms Presented By: H.Amerehie

روش استراسن

Presented By:H.Amerehie

22 از

37

Page 23: Foundations of algorithms Presented By: H.Amerehie

تقسیم ماتریس ها :

برای ماتریس های بزرگ . . .

Presented By:H.Amerehie

23 از

37

Page 24: Foundations of algorithms Presented By: H.Amerehie

مثال

برای ماتریس های بزرگ . . .

Presented By:H.Amerehie

24 از

37

Page 25: Foundations of algorithms Presented By: H.Amerehie

الگوریتم استراسن

Presented By:H.Amerehie

25 از

37

Page 26: Foundations of algorithms Presented By: H.Amerehie

ضرب

پیچیدگی زمانی ضرب استراسن – تمامی حاالت

Presented By:H.Amerehie

26 از

37

Page 27: Foundations of algorithms Presented By: H.Amerehie

جمع و تفریق

پیچیدگی زمانی ضرب استراسن – تمامی حاالت

Presented By:H.Amerehie

27 از

37

Page 28: Foundations of algorithms Presented By: H.Amerehie

مقایسه

Presented By:H.Amerehie

28 از

37

Page 29: Foundations of algorithms Presented By: H.Amerehie

محاسبات با اعداد صحیح بزرگ

Presented By:H.Amerehie

29 از

37

Page 30: Foundations of algorithms Presented By: H.Amerehie

ضرب اعداد صحیح بزرگ

Presented By:H.Amerehie

30 از

37

Page 31: Foundations of algorithms Presented By: H.Amerehie

ضرب

Presented By:H.Amerehie

31 از

37

Page 32: Foundations of algorithms Presented By: H.Amerehie

الگوریتم ضرب اعداد بزرگ

Presented By:H.Amerehie

32 از

37

Page 33: Foundations of algorithms Presented By: H.Amerehie

پیچیدگی زمانی ضرب اعداد بزرگ – بدترین حالت

Presented By:H.Amerehie

33 از

37

Page 34: Foundations of algorithms Presented By: H.Amerehie

کاهش تعداد ضرب ها

Presented By:H.Amerehie

34 از

37

Page 35: Foundations of algorithms Presented By: H.Amerehie

الگوریتم جدید ضرب اعداد صحیح بزرگ

Presented By:H.Amerehie

35 از

37

Page 36: Foundations of algorithms Presented By: H.Amerehie

پیچیدگی زمانی الگوریتم جدید ضرب اعداد صحیح بزرگ– بدترین حالت

Presented By:H.Amerehie

36 از

37

Page 37: Foundations of algorithms Presented By: H.Amerehie

مواقعی که نباید از تقسیم و حل استفاده کرد

Presented By:H.Amerehie

37 از

37