some notes on data structures used in search algorithms
play

Some notes on data structures used in search algorithms - PowerPoint PPT Presentation

Some notes on data structures used in search algorithms Freitagsseminar Tobias Denkinger tobias.denkinger@tu-dresden.de Institute of Theoretical Computer Science Faculty of Computer Science Technische Universitt Dresden 2018-11-09 T.


  1. Some notes on data structures used in search algorithms Freitagsseminar Tobias Denkinger tobias.denkinger@tu-dresden.de Institute of Theoretical Computer Science Faculty of Computer Science Technische Universität Dresden 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) 2018-11-09 1 / 9

  2. Outline 1 Pushdowns 2 Log-domain 3 Double-ended priority queues T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) 2018-11-09 2 / 9

  3. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  4. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  5. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  6. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  7. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  8. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  9. Pushdowns 𝒫(1) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) Methods 6.2, pp. 306–318. doi: 10.1137/0606031 1 R. E. Tarjan (Apr. 1985). “Amortized Computational Complexity”. SIAM Journal on Algebraic Discrete Pushdown (Rustomata) Vec (Rust) List (Haskell), vector (C++), examples 𝒫(𝑜) Usage: e.g. in pushdown automata; represent backlinks in graph search clone 𝒫(1) 𝒫(1) (amortised 1 ) push 𝒫(1) 𝒫(1) pop, peek (lazy) linked list growable array Complexities: 3 / 9

  10. Pushdowns – Rustomata pub fn pop(self) -> Result<(Self, A), Self> { 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) } 91 } 90 Pushdown::Cons{val,below} => Ok((below.deref().clone(), val)), 89 ), => Err(Pushdown::Empty Pushdown::Empty 88 match self { 87 86 Idea: share prefixes via pointer + copy on write -- approximately [cf. rustomata on github] use algebraic data type (a.k.a. tagged union) Haskell: data [a] = [] | a : [a] Rust: current element is always unique 10 pub enum Pushdown<A> { 11 Empty, 12 Cons {val: A, below: Rc<Pushdown<A>>}, 13 } 4 / 9

  11. Pushdowns – Rustomata pub fn pop(self) -> Result<(Self, A), Self> { 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) } 91 } 90 Pushdown::Cons{val,below} => Ok((below.deref().clone(), val)), 89 ), => Err(Pushdown::Empty Pushdown::Empty 88 match self { 87 86 Idea: share prefixes via pointer + copy on write -- approximately [cf. rustomata on github] use algebraic data type (a.k.a. tagged union) Haskell: data [a] = [] | a : [a] Rust: current element is always unique 10 pub enum Pushdown<A> { 11 Empty, 12 Cons {val: A, below: Rc<Pushdown<A>>}, 13 } 4 / 9

  12. Pushdowns – Rustomata pub fn pop(self) -> Result<(Self, A), Self> { 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) } 91 } 90 Pushdown::Cons{val,below} => Ok((below.deref().clone(), val)), 89 ), => Err(Pushdown::Empty Pushdown::Empty 88 match self { 87 86 Idea: share prefixes via pointer + copy on write -- approximately [cf. rustomata on github] use algebraic data type (a.k.a. tagged union) Haskell: data [a] = [] | a : [a] Rust: current element is always unique 10 pub enum Pushdown<A> { 11 Empty, 12 Cons {val: A, below: Rc<Pushdown<A>>}, 13 } 4 / 9

  13. Idea: use bijection ln : ℝ ≥0 → ℝ ∪ {∞} Log-domain multiplication becomes addition ⟹ ln (⋅) = (+) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) What about ln (+) ? 218 } LogDomain(self.ln().add(other.ln())) 217 216 fn mul(self, other: Self) -> Self { 70 pub struct LogDomain<F: Float>(F); Usage: represent probabilities (especially small values) use newtype to avoid runtime overhead (e.g. in Haskell and Rust) 94 } LogDomain(value.ln()) 93 92 fn new_unchecked(value: F) -> Self { 91 /// Same as ‘new‘, but without bounds check. [cf. rust-log-domain on github] 5 / 9

  14. Log-domain multiplication becomes addition ⟹ ln (⋅) = (+) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) What about ln (+) ? 218 } LogDomain(self.ln().add(other.ln())) 217 216 fn mul(self, other: Self) -> Self { 70 pub struct LogDomain<F: Float>(F); Usage: represent probabilities (especially small values) use newtype to avoid runtime overhead (e.g. in Haskell and Rust) 94 } LogDomain(value.ln()) 93 92 fn new_unchecked(value: F) -> Self { 91 /// Same as ‘new‘, but without bounds check. [cf. rust-log-domain on github] 5 / 9 Idea: use bijection ln : ℝ ≥0 → ℝ ∪ {∞}

  15. Log-domain multiplication becomes addition ⟹ ln (⋅) = (+) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) What about ln (+) ? 218 } LogDomain(self.ln().add(other.ln())) 217 216 fn mul(self, other: Self) -> Self { 70 pub struct LogDomain<F: Float>(F); Usage: represent probabilities (especially small values) use newtype to avoid runtime overhead (e.g. in Haskell and Rust) 94 } LogDomain(value.ln()) 93 92 fn new_unchecked(value: F) -> Self { 91 /// Same as ‘new‘, but without bounds check. [cf. rust-log-domain on github] 5 / 9 Idea: use bijection ln : ℝ ≥0 → ℝ ∪ {∞}

  16. Log-domain multiplication becomes addition ⟹ ln (⋅) = (+) 2018-11-09 T. Denkinger: Some notes on data structures used in search algorithms (Freitagsseminar) What about ln (+) ? 218 } LogDomain(self.ln().add(other.ln())) 217 216 fn mul(self, other: Self) -> Self { 70 pub struct LogDomain<F: Float>(F); Usage: represent probabilities (especially small values) use newtype to avoid runtime overhead (e.g. in Haskell and Rust) 94 } LogDomain(value.ln()) 93 92 fn new_unchecked(value: F) -> Self { 91 /// Same as ‘new‘, but without bounds check. [cf. rust-log-domain on github] 5 / 9 Idea: use bijection ln : ℝ ≥0 → ℝ ∪ {∞}

Recommend


More recommend