/
Dueling Algorithm Dueling Algorithm

Dueling Algorithm - PowerPoint Presentation

danika-pritchard
danika-pritchard . @danika-pritchard
Follow
375 views
Uploaded On 2017-12-08

Dueling Algorithm - PPT Presentation

DUEL i and j if j i m then no conflict otherwise s T iW ji11 Cases if s then if sPWji1 then kill j else ID: 613617

list dies case endwhile dies list endwhile case goto candidates add element potential loop main kill cases duel elements

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Dueling Algorithm" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Dueling AlgorithmSlide2

DUEL

i and j

if j-i ≥ m then “no conflict”otherwise s T[i+W[j-i+1]-1]Cases:if s=* then “*”if s=P[W[j-i+1]] then kill j else kill i

 Slide3

Data Structures

List of potential candidates

R = rightmost element of that list N

= new element

R

NSlide4

Initialization

Add 1 to list R  1 N  2

RNSlide5

Main Loop

While n-N ≥ m-1 (new candidate fits) do:

If N-R ≥ m (candidates are far) then: add N to list

R  N N  N+1 goto endWhileSlide6

Candidates are far

R

NSlide7

Main Loop

(Candidates are within mutual range)

Duel R and NCases:

N dies R dies * (both live)endWhileSlide8

Case 1: N dies

If N dies then:

N  N+1

goto endWhileSlide9

Case 1: N dies

R

N

X

NSlide10

Case 2: R dies

If R dies then: Remove R from list.

If list empty then: R  N N  N+1

Goto endWhile else:R points to previous element in listGoto endWhile Slide11

Case 2: R dies

R

N

XSlide12

Case 3: * (no one dies)

If * then:

add N to list R  N N  N+1

Goto endWhile Slide13

Case 3: * (no one dies)

R

NSlide14

At end of Algorithm:

All elements in list are potential candidates.

All elements in list agree with each other.