Hi,
I recently tried SHTARR problem and I maintained a sorted list of numbers for each block. (Code)
Update (+) : I deleted my previously sorted block and remake the sorted list again
Query (?) : First traverse current block naively & then binary search on other blocks.
I run a test case with following constraints
t=1
n=1000000
q=100000
I was amazed to see the time taken by my code is 107.515 sec and 50715 calls to blockprocessor.
According to me the complexity is decided by update in this code which should at most take O(t*BS*q)
BS = Block Size =1000
which in this test case should not exceed 10e8 operations(Simply copy & comparison) & I thought this should at most take 10sec, at least not more than that even if I consider my CPU frequency not same as server.
Can please someone point out the mistake I am doing