avatar

Coderek's blog

Loneliness is the gift of life
Posts tagged with data-structure

Binary indexed tree (BIT) is an interesting data structure. It makes calculating and updating prefix sum efficient. In the old way of keeping prefix sum, you have to keep an accumulative array c[]. E…

Read more ››

Recently, I discovered two interesting data structures, Segment tree and Binary index tree (BIT). Both data structures are good at managing some range of aggregated values. For example, in a discrete…

Read more ››

Coroutine

以前也听说过coroutine这个词,当时以为只是helper function的另外一种说法,故没有去研究个所以然。后来做unity3D project的时候有一次看到这个词,在文档里记录的例子是一个等待的程序,如下: yield WaitForSeconds(5.0); 这个看起来不就是一个简单的wait吗,用一个loop一个timer就可以实现的一个东西而已。我当时这么认为。unity的d…

Read more ››