Skip to main content

inverse_ackermann

Function inverse_ackermann 

Source
fn inverse_ackermann(n: usize) -> usize
Examples found in repository?
crates/competitive/src/data_structure/static_range_product.rs (line 55)
44    pub fn new(data: Vec<S::T>) -> Self {
45        let n = data.len();
46        if n == 0 {
47            return Self {
48                data,
49                block_shift: 0,
50                prefix: Vec::new(),
51                suffix: Vec::new(),
52                between: None,
53            };
54        }
55        let block_shift = scaled_block_shift(inverse_ackermann(n));
56        let block_size = 1usize << block_shift;
57        let blocks = block_products::<S>(&data, block_size);
58        let between = if blocks.products.len() > 2 {
59            let level = inverse_ackermann(blocks.products.len()).max(1);
60            Some(FixedRangeProduct::new(blocks.products, level))
61        } else {
62            None
63        };
64        Self {
65            data,
66            block_shift,
67            prefix: blocks.prefix,
68            suffix: blocks.suffix,
69            between,
70        }
71    }