INNER CODE UNIT · Python

pf

lschoe/mpyc · demos/PrefixOrExplained.py:284

    def pf(a, x):
        n = len(x)
        if n == 1:
            return [a | x[0]]
        
        y0 = pf(a, x[:n//2])
        y1 = pf(y0[-1], x[n//2:])
        return y0 + y1

    return pf(0, x)


# But this simple idea fails "miserably". Its performance is just as bad as for `prefix_or0()` above:

# In[19]:


correctness(prefix_or5)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…