Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
throwaput
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
throwaput
10y ago
Yet I have only one idea - that we can permute the elements somehow (in a O(1) reversible way like a Gray code) so that the cycles would form something computable in O(n) time and O(1) space
2.
▲
by
throwaput
10y ago
Even for power of two it's not correct, forget my statement about cycles.
3.
▲
by
throwaput
10y ago
On the first glance the first problem seems quite impossible. For example, if n is power of two, then for each prime number < n there will be a cycle starting with that number. If n is not a power of two, I haven't yet seen any good