
Understanding the Dueling Algorithm for Data Structures
Explore the Dueling Algorithm for efficient conflict resolution in data structures. Learn about dueling cases, candidates, initialization, main loop, and algorithm completion. Witness how potential candidates interact and agree within mutual ranges.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
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
Data Structures List of potential candidates R = rightmost element of that list N = new element R N
Initialization Add 1 to list R 1 N 2 R N
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 endWhile
Main Loop (Candidates are within mutual range) Duel R and N Cases: N dies R dies * (both live) endWhile
Case 1: N dies If N dies then: N N+1 goto endWhile
Case 1: N dies X R N N
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 list Goto endWhile
Case 2: R dies X R N
Case 3: * (no one dies) If * then: add N to list R N N N+1 Goto endWhile
At end of Algorithm: All elements in list are potential candidates. All elements in list agree with each other.