ps t e etasats Transformations - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

ps t e etasats Transformations

Description:

?etas?? at?s ?? t?? ?d??? p?? ?? at?? ???s? ?p????ta? ??a ape?????s? ... for i= floor(n/2) to 1. k=i; v=H[k]; heap= false; while !heap and 2*k =n. j=2*k; if j n ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 35
Provided by: christosp1
Category:

less

Transcript and Presenter's Notes

Title: ps t e etasats Transformations


1
?p???s? ???ß??µ?t?? µe ?etas??µat?sµ???
(Transformations)
2
?e??????
  • ?p???s? p??ß??µ?t?? ???s?µ?p????ta?
    µetas??µat?sµ???
  • ?etas??µat?sµ?? t?? p??ß??µat?? se p?? e?????
    ??d?s? (instance simplification)
  • ?etas??µat?sµ?? t?? ?d??? p??ß??µat??
    ???s?µ?p????ta? ??a ape?????s? (representation
    change)
  • ?etas??µat?sµ?? t?? p??ß??µat?? se d?af??et???
    p??ß??µa t?? ?p???? ? ??s? e??a? ???st?.

3
Presorting
  • ?????? f???? ? ??s? e??? p??ß??µat?? e??a? p??
    e????? e?? ta ded?µ??a t?? p??ß??µat?? e??a?
    ta????µ?µ??a.
  • ?p?ta?, ??a ??p??a p??ß??µata, ? ta????µ?s? t??
    ded?µ???? µp??e? ?a ap?te??se? t? p??t? ß?µa.
  • ?a??de??µata
  • ???es? t?? p??s??ste??? s?µe???
  • convex hull
  • ? ta????µ?s? µp??e? ?a ???e? se ?????

4
?p???s? S?st?µat?? ???s?se??
  • ?p???ste t? s?st?µa e??s?se??
  • ?? ?p??? ???feta? ?a? ??
  • ??e?te t? d????sµa x ??a t? ?p??? ?s??e? ? p??
    p??? e??s?s?.
  • ?p???e? p??ta ??s?

5
Gauss Elimination
  • ???s?µ?p????ta? elementary operations
    µetas??µat????µe t?? a????? p??a?a Ab µ???? ?a
    ???e? s?ed?? t?????????.
  • Elementary operations
  • ????ap?as?asµ?? µ?a? e??s?s?? µe µ?a sta?e??
  • ??t??at?stas?? µ?a? e??s?s?? µe t? ?????sµa t??
    e??s?s?? µe ??p??? p???ap??s?? µ?a? ?????
    e??s?s??
  • ?p? t?? s?ed?? t???????? p??a?a e??a? e????? ?a
    ß???µe t? ??t??µe?? ??s? st? s?st?µa.

6
Gauss Elimination Algorithm
GE(Anxn,bn) for i1 to n Ai,n1bi for
i1 to n for j i1 to n v
Aj,i/Ai,i for k i to n1 Aj,k
Aj,k vAi,k
  • ?p?d?s?
  • ???a?? p??ß??µata
  • ?? ?a s?µße? e?? se ??p??a epa?????? t? Ai,i
    e??a? p??? µ????

7
LU Decomposition
  • ?a?at???s?
  • ? p??a?a? A µp??e? ?a a?a???e? st? ????µe?? d??
    ????? p??????

8
?a??de??µa LU Decomposition
9
Gauss Elimination ?a? LU Decomposition
  • ?p????µe ?a a?t??atast?s??µe ALU st? s?st?µa
    e??s?se??.
  • ?p?s?? µp????µe ?a ???s??µe ??a ??? d????sµa
    yUx, ?p?ta?
  • ????µe sp?se? d??ad? t? s?st?µa e??s?se?? se d??
    s?st?µata!
  • ?a d?? a?t? s?st?µata e??a? p?? e????a ?a ??????,
    ??at?
  • ??a ? ap?d?s? a?t?? t?? a??????µ??
  • ??te e??a? ep???µ?t? ?a t?? ???s?µ?p???s??µe

10
???e? ?fa?µ???? t?? GE
  • ???es? t?? a?t?st??f?? e??? p??a?a
  • ? e??es? t?? a?t?st??f?? a?t?st???e? µe t??
    ep???s? n s?st?µ?t?? e??s?se??
  • ?p??e? ?a ???s?µ?p????e? t? LU Decomposition ??a
    ?a ???e? t?? d?ad??as?a a?t? p?? ap?d?t???.

11
???t?a AVL
  • ?a d??t?a AVL e??a? d?ad??? d??t?a a?a??t?s?? t??
    ?p???? ? s??te?est?? ?s????p?a? (balance factor)
    ???e ??µß?? e??a? µ??? 1, 0, -1.
  • S??te?est?? ?s????p?a? ? d?af??? ????? µeta??
    t?? a??ste??? ?a? de???? ?p?d??t???

12
??at???s? ???t??? AVL
  • G?a ?a d?at????e? ??a d??t?? AVL µet? ap?
    p??s???? ? afa??es? ??µß??, ?p?????? t?sse?e??
    pe??st??f?? ?? ?p??e? µp????? ?a ???s?µ?p???????
  • ???ste?? pe??st??f? (L-Rotation)
  • ?e??? pe??st??f? (R-Rotation)
  • ???ste??-?e??? pe??st??f? (LR-Rotation)
  • ?e???-a??ste?? pe??st??f? (RL-Rotation)
  • ?? pe??st??f?? a?t?? ?s????p??? t? d??t?? ?a?
    d?at????? t?? ?d??t?te? t?? d?ad???? d??t???
    a?a??t?s??.

13
?e??? ?e??st??f?
???t?a ?d??? ?????
? a??ste?? pe??st??f? e??a? ap?? s?µµet????.
14
???ste??-?e??? ?e??st??f?
  • ?? ap?t??esµa pa?aµ??e? d?ad??? d??t??
    a?a??t?s??
  • ? de???-a??ste?? pe??st??f? e??a? s?µµet????.

15
2-3 ???t?a
  • ?a 2-3 d??t?a e??a? d??t?a a?a??t?s?? µe d?? e?d?
    ??µß???
  • ??µß??? µe ??a ??e?d? (d?? pa?d??) 2-node.
  • ?a pa?d?? sta a??ste?? ????? µ????te?a ? ?sa
    ??e?d?? µe t?? ??µß?.
  • ?a pa?d?? sta de??? µe?a??te?a ??e?d??.
  • ??µß??? µe d?? ??e?d?? ?1 lt ?2 (t??a pa?d??)
    3-node.
  • ?a pa?d?? sta a??ste?? ????? ??e?d?? µ????te?a ?
    ?sa µe ?1.
  • ?a pa?d?? st? µ?s? ????? ??e?d?? µe?a??te?a ap?
    ?1 ?a? µ????te?a ? ?sa µe ?2.
  • ?a pa?d?? sta de??? ????? ??e?d?? µe?a??te?a ap?
    ?2.
  • ?a d??t?a a?t? e??a? p??t?te ap???ta
    ?s????p?µ??a.
  • ??at???s? ?s?????sµ??
  • ?ta? ??a ??? ??e?d? ft?se? se ??a f???? t?p??
    2-node t?te a?t?? µetat??peta? se 3-node.
  • ?ta? ??a ??? ??e?d? ft?se? se ??a f???? t?p??
    3-node t?te a?t?? sp??e? se d?? 2-node ?a?
    st???e? t? µesa?? ??e?d? st? ????a.

16
?a??de??µa
  • ?p???ste p?? ta ??e?d?? ft????? µe t?? a???????
    se??? 9, 5, 8, 3, 2, 4, 7.

17
?a??de??µa
  • ?p???ste p?? ta ??e?d?? ft????? µe t?? a???????
    se??? 9, 5, 8, 3, 2, 4, 7.

4, 5
18
Heap
  • ???sµ?? t?? Heap
  • ???a? ??a d?ad??? d??t?? (d?? pa?d?? a?? ??µß?)
    t? ?p??? e??a? e?te s?µp????µ??? e?te t?? ?e?p???
    ??p??a f???a ap? t? te?e?ta?? ep?ped? (sta
    de???).
  • ? ????a? ??e? p??ta µe?a??te?? ??e?d? (? ?s?) µe
    ta pa?d?? t??.

19
Heap
  • ?d??t?te? t?? Heap
  • ?p???e? µ??? ??a s?µp????µ??? d??t?? µe n ??µß???
    t?? ?p???? t? ???? e??a?
  • ? ???a t?? d??t??? e??a? t? µ???st? ??e?d?
  • ??a? ??µß?? µe ta pa?d?? t?? ap?te???? p??? heap.
  • ??a heap ???p??e?ta? e????a sa? p??a?a?
  • ?a pa?d?? t?? ??µß?? i e??a? st?? ??se?? 2i, ?a?
    2i1.
  • ? ????a? t?? ??µß?? j ß??s?eta? st? ??s?
  • G?at? Heap
  • ???p???s? ????? µe p??te?a??t?te?.
  • ???s?e? ? d?a???fe? t? a?t??e?µe?? µe t?
    µe?a??te?? p??te?a??t?ta.
  • ???s??te? ??a a?t??e?µe?a

20
??µ??????a Heap-1
  • ??µ??????a Heap (ap? p??? p??? ta ??t?)
  • ?p???t??µe p?? ????µe heap µe n-1 ??µß???.
  • ???s??t??µe t?? ??µß? n st?? te?e?ta?a ??s?.
  • S????????µe t? ??e?d? t?? ??µß?? n µe a?t? t??
    ????a floor(n/2).
  • ??? e??a? µ????te??, t? heap e??a? ?t??µ?
  • ??? ???, a?ta??????µe t?? ??se?? ????a ?a?
    pa?d??? ?a? epa?a?aµß????µe

21
??µ??????a Heap-2 (ap? ??t? p??? ta p???)
Heap2(H1n) for i floor(n/2) to 1 ki
vHk heap false while !heap and
2kltn j2k if jltn if HjltHj1
jj1 if vgtHj heap true else
HkHj k j Hkv
22
?p?d?s? ???????µ?? ??µ??????a? Heap-2
  • ??a heap ??e? hfloor(log2n) ep?peda (t? ???? t??
    d??t???)
  • Se ???e ep?ped? i ?p?????? 2i ??µß??
  • ?et? ap? ???e ??e???, ??a? ??µß?? µp??e? ?a
    ß?e?e? ap? t? ep?ped? i st? h (?a ???e? d??ad?
    f????)
  • ??? s?????se?? se ???e ß?µa

Heap2(H1n) for i floor(n/2) to 1 ki
vHk heap false while !heap and
2kltn j2k if jltn if HjltHj1
jj1 if vgtHj heap true else
HkHj k j Hkv
23
???s???? ?a? ??a??af? ??e?d??? ap? t? Heap
  • G?a t?? p??s???? ????µe ?d? de? t?? a??????µ? ?
    ?p???? e??a? t???? O(log n). G?at?
  • G?a t? d?a??af? t?? µe?a??te??? ??e?d???,
  • ??ta??????µe t? ???a µe t? te?e?ta?? ??e?d? t??
    heap.
  • ?e?????µe t? µ??e??? t?? heap se n-1.
  • ??????µe t? d?ad??as?a d?µ??????a? heap-2
    (heapify) µ??? ??a i1. (st? p??t? for loop,
    i1 to 1).
  • ?e a?t? t?? t??p? ? ???a p?fte? st? s?st? ep?ped?
    µe µ??? O(log n) s?????se??.
  • HeapSort()
  • ??????µe t? d?ad??as?a d?a??af?? t?? µe?a??te???
    ??e?d??? n f????.
  • ?p?d?s? O(nlog n). G?at?

24
?p?????sµ?? ???????µ??
  • S?ed??ste ??a a??????µ? ??a t?? ?p?????sµ? t??
    p??????µ?? p(x) ??a ??e? t?? t?µ?? t?? x.

25
?p?????sµ?? ???????µ?? Horners Rule
  • ?p?? a?ad????a??ste t??? ????? t?? p??????µ??.

26
?p?????sµ?? ???????µ?? Horners Rule
27
?e??s? ???ß??µat?? (Problem Reduction)
  • ?as??? ?d?a
  • ?etas??µat????µe t? p??ß??µa p??? ep???s? se ??a
    ???? p??ß??µa t? ?p??? ?????µe p?? ?a ep???s??µe!
  • ?a??de??µa
  • T?µ??e?te t?? a??????µ? e??es?? t?? convex hull
    ???s?µ?p????ta? a??????µ? t?p??
    divide-and-conquer. St? a??????µ? a?t? ?p?epe ?a
    ?p?????sete t? s?µe?? p?? ß??s?eta? p?? µa????
    ap? µ?a e??e?a.
  • ?? p??ß??µa a?t? µetas??µat?st??e se p??ß??µa
    e??es?? t?? eµßad?? e??? t???????.

28
?????st? ????? ????ap??s??
  • ??? µp??e?te ?a ?p?????sete t? e????st? ?????
    p???ap??s?? d?? a???µ?? m, n.
  • ?????st? ????? p???ap??s?? e??a? ? µ????te???
    a???µ?? ? ?p???? d?a??e?ta? ?a? ap? t??? d??
    ????? ?a af??e? ?p????p?.
  • Algorithm1()
  • Find the prime factors of m
  • Find the prime factors of n
  • Identify all common factors that appear in both
  • Compute the product of all factors but use the
    common factors only once.
  • Algorithm2()

29
????µ?? ????pat??? µeta?? d?? ??µß?? se ???f?
  • ??e?te t?? a???µ? t?? µ???pat??? µeta?? t??
    ??µß?? i ?a? j ta ?p??a ????? µ???? kgt0.
  • ??s?
  • ? a???µ?? t?? µ???pat??? d??eta? ap? t? st???e??
    (i,j) t?? p??a?a Ak.
  • ?a??de??µa
  • St?? p?? ??t? ???f?, p?sa µ???p?t?a µ????? 2
    ?p?????? ap? t?? a st?? d.

30
??a??st?p???s? ? ?e??st?p???s? S????t?s??
  • ??e?te t? µ???st? t?µ? t?? s????t?s?? f(x).
  • ??e?te t? e????st? t?µ? t?? s????t?s?? f(x).
  • ?a?at???s?

31
G?aµµ???? ?????aµµat?sµ??
  • ??a? µe????? a???µ?? p??ß??µ?t?? ap?f?se?? ?a?
    ße?t?st?p???s?? µp??e? ?a µe???e? ? ?a
    µ??te??p????e? ???s?µ?p????ta? G?aµµ???
    ?????aµµat?sµ?
  • St? ?e???? t?? µ??f?, ??a t?t??? p??ß??µa
    d?at?p??eta? ?? a????????
  • Se p??ß??µata ?p?? ?? µetaß??t?? ap?fas?? µp?????
    ?a p????? p?a?µat???? t?µ??, t?te t? p??ß??µa
    µp??e? ?a ???e? µe t? µ???d? simplex ? ?p??a
    e??a? ?e???? ap???t???

32
?a??de??µa G?aµµ???? ?????aµµat?sµ?? (G?)
  • ?p???ste p?? ??ete 100 ???? ta ?p??a ???ete ?a
    epe?d?sete se µp??e? ??a t? ep?µe?? p??t? p??
    d????a???eta?. St?? a???? ?p?????? ?? a????????
    t?e?? µp??e?
  • ? µe t?µ? pa t? ??t?? ?a? pe??e?t???t?ta a?????
    ca.
  • B µe t?µ? pb t? ??t?? ?a? pe??e?t???t?ta a?????
    cb.
  • C µe t?µ? pc t? ??t?? ?a? pe??e?t???t?ta a?????
    cc.
  • ???ete ?t? ?? pe??ss?te??? ap? t??? f????? sa?
    p??t?µ??? t?? µp??a A ?p?ta? ?a ???ate t??????st?
    ?? µ?s?? µp??e? p?? ?a a????sete ?a e??a? µ???a?
    A.
  • ??at?p?ste ??a p??ß??µa G? p?? ?a sa? ß????se? ?a
    a????sete t?? µp??e? ?a? ?a µe??st?p???sete t?
    a????? p?? ?a a????sete.

33
?e??s? p??ß??µ?t?? se ???f???
  • G?at? µa? e?d?af????? ta p??ß??µata ???f??
  • ????? p??ß??µata µp????? ?a d?at?p????? sa?
    p??ß??µata ???f?? ??a ta ?p??a ?p?????? ??se??!
  • ?a?ade??µata
  • S??t?µ?te?? µ???p?t?
  • ?????st? d??t?? ep????????
  • Hamiltonian paths

34
?a??de??µa µe??s?? se p??ß??µa ???f??
  • ??a? ßa?????? p??pe? ?a pe??se? ??a ????, µ?a
    ?ats??a ?a? ??a µa????? ap? t?? µ?a ???? t??
    p?taµ?? st?? ???? ???s?µ?p????ta? µ?a ß???a st??
    ?p??a µp??e? ?a ????se? µ??? ??a a?t??e?µe??!
  • ?aµß????ta? ?p??? t??? pe?????sµ??? t??
    p??ß??µat??, p?? µp??e? ?a t? pet??e? µe t?
    µ????te?? a???µ? d?ad??µ??

???µ?
?µ???
???µ? ?a??????, ?????, ?ats??a, µa?????, p?t?µ?,
a?t?st???a
??µ??
µ????
????µ
??µ??
????µ
????µ
????µ
????µ
Write a Comment
User Comments (0)
About PowerShow.com