Bài giảng môn Cấu trúc dữ liệu và giải thuật

pdf 46 trang vanle 1310
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng môn Cấu trúc dữ liệu và giải thuật", để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên

Tài liệu đính kèm:

  • pdfbai_giang_mon_cau_truc_du_lieu_va_giai_thuat.pdf

Nội dung text: Bài giảng môn Cấu trúc dữ liệu và giải thuật

  1. Data Structure and Algorithm
  2. a a Data Structure and Algorithm
  3. eooa aeoeyaoa oaaaeye eeoaaaeeeaaoey aoeeee oeeeaeaye oeoey oeey o ư ư Data Structure and Algorithm
  4. o o o oaaee Data Structure and Algorithm
  5. o a ayươư aoo aoưyư aư o oay yoư o aưao Data Structure and Algorithm
  6. oaa ooayy yưư ưao yưo ooayoưa ư ư eoư y ưư Data Structure and Algorithm
  7. oươ a oưa y Data Structure and Algorithm
  8. yư o oaaee Data Structure and Algorithm
  9. oaư ưaaươ yươa oao o ư ay aeaaeaoeae aoo ooea oaaee Data Structure and Algorithm
  10. yy yeo a a a a oaaee Data Structure and Algorithm
  11. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  12. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  13. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  14. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  15. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  16. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  17. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  18. ư for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” o i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  19. Data Structure and Algorithm
  20. oa ayoy ao o o o ư yưy ư o y Data Structure and Algorithm
  21. ư ư ya o ao aoaay o ư y a oư aoươ o eư Data Structure and Algorithm
  22. aươyư ưoư ư a ươ Data Structure and Algorithm
  23. ee e ư aaaayeoư a oa Data Structure and Algorithm
  24. ơ  ooea oo  e  a  y oo  oaoe oaaaoaeeeeae Data Structure and Algorithm
  25. oe oee e eo ayee a ay e aaye e a ee oaaaoaeeeeae Data Structure and Algorithm
  26. ư Data Structure and Algorithm
  27.   aao  ưo  ưo Data Structure and Algorithm
  28. cost times for to j=2 length (A) c1 n do key=A[j] c2 n-1 “chèn A[j] vào phần đã 0 n-1 sắp xếp A[1 j-1]” i=j-1 c3 n n-1 while and t i>0 A[i]>key c4 ∑ j= j n − do A[i+1]=A[i] c ∑ = t j 5 n j i c t − 6 ∑ j= j A[i+1]:=key c7 n-1 oaaee Data Structure and Algorithm
  29. ư ư → tj=1, a f(n), tuyến tính ư o ư n n + n n → t = j = − ≈ f n tj=j ∑ j ∑ j= j= a f(n 2), ư → tj=j/2, a f(n 2), Data Structure and Algorithm
  30.  yoa na oaaee Data Structure and Algorithm
  31.  oae aeaeae eae e aee Data Structure and Algorithm
  32. ưưư  ưy aaư  ưyaưyo o  ưưe  yưư Data Structure and Algorithm
  33. 1,00E+10 1,00E+09 1,00E+08 n log n 1,00E+07 sqrt n n log n 1,00E+06 100n n^2 1,00E+05 n^3 T(n) 1,00E+04 1,00E+03 1,00E+02 1,00E+01 1,00E+00 1,00E-01 2 4 8 16 32 64 128 256 512 1024 n Data Structure and Algorithm
  34. 1,00E+155 1,00E+143 1,00E+131 1,00E+119 n log n 1,00E+107 sqrt n 1,00E+95 n log n 100n 1,00E+83 n^2 T(n) n^3 1,00E+71 2^n 1,00E+59 1,00E+47 1,00E+35 1,00E+23 1,00E+11 1,00E-01 2 4 8 16 32 64 128 256 512 1024 n Data Structure and Algorithm
  35. o ưaa  oưa  a  a  a f(n log n) Data Structure and Algorithm
  36. o ưa ươ aoa ươ aoo yưea oaooư ayoayo a Data Structure and Algorithm
  37. ươao oy ưooao oư ayoeoa ươao oy oeaoaoo ư ư ayooeoa Data Structure and Algorithm
  38. Data Structure and Algorithm
  39. eoưo o ươưo Data Structure and Algorithm
  40. for j=2 to length (A) do key=A[j] “chèn A[j] vào phần đã sắp xếp A[1 j-1]” i=j-1 while i>0 and A[i]>key do A[i+1]=A[i] i A[i+1]:=key Data Structure and Algorithm
  41. oyoơ aooy o NIL o aa a a NIL Data Structure and Algorithm
  42. j=1 while j<= length (A) and A[j]!=q do j++ if j<= length (A) then return j else return NIL  ư f(n) ư f(n/2)  yưaooy Data Structure and Algorithm
  43. y aooy o NIL o aa a a NIL Data Structure and Algorithm
  44.  ưa oơ left=1 right= length (A) do j=(left+right)/2 if A[j]==q then return j else if A[j]>q then right=j-1 else left=j+1 while left<=right return NIL Data Structure and Algorithm
  45. yao  aa  aaoa  lg n Data Structure and Algorithm
  46. Data Structure and Algorithm