Skip to content

Commit

Permalink
Use battle-tested PATRICIA tree (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavam committed May 10, 2024
1 parent e4a38ea commit 797376a
Show file tree
Hide file tree
Showing 2 changed files with 1,237 additions and 0 deletions.
26 changes: 26 additions & 0 deletions libtenzir/include/tenzir/detail/patricia_tree.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// _ _____ __________
// | | / / _ | / __/_ __/ Visibility
// | |/ / __ |_\ \ / / Across
// |___/_/ |_/___/ /_/ Space and Time
//
// SPDX-FileCopyrightText: (c) 2024 The Tenzir Contributors
// SPDX-License-Identifier: BSD-3-Clause

#pragma once

namespace tenzir::detail {

/// A PATRICIA trie or *tree* (as Knuth calls it) is trie with radix of two.
/// Nodes exist to identify the bits that distinguish the keys. Each node is
/// exactly two children, like a binary tree, and therefore the number of nodes
/// is the number of keys.
class patricia_tree {
public:
patricia_tree() = default;

private:
class impl;
std::unique_ptr<impl> impl_;
};

} // namespace tenzir::detail

0 comments on commit 797376a

Please sign in to comment.