TransWikia.com

Counting one's in a stream of bits

Computer Science Asked by srajan on October 21, 2021

I have to count the number of one’s in last $m$ bits in a stream of bits and $m leq n,$ where $n$ is the window size and it should take polylogarithmic space in $n$. I could only store last $n$ bits and then count the number of one’s in those $n$ bits but it takes $O(n)$ space. How to achieve it in $O(log^k n)$, $k>0$.
Any hint would be appreciated.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP