Some data structures — pointers or arrays?

Правка en4, от Pluteum, 2022-10-22 16:59:50

Hello! There're some data structures requires dynamically allocating memory, such as treap, splay treeans so on. In a recent contest, I saw a problem requiring those data structures, 1737G and noticed many legendary users submitted using pointers: 175023666, 175037024, 175043108 and 175054239...

But somewhat in a Chinese OJ, many people told me that pointers are way slower than using arrays(to create a global array with sufficient number of elements and simulate the pointers), and we should avoid using pointers. Even if we use pointers, we are not supposed to use operator new, but to open a memory pool(this way is then similar to arrays). In fact, we can also notice that for the above problem, almost all Chinese users submitted using arrays: 175027760, 175218209 and 175032925...

What's your opinion on this topic? I'm currently using pointers, should I insist on using pointers or change my coding way? Any help is appreciated!

Теги data structures, pointers, arrays

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Pluteum 2022-10-22 16:59:50 133
en3 Английский Pluteum 2022-10-22 16:54:15 1 Tiny change: '209] and [[submissio' -> '209] and [submissio'
en2 Английский Pluteum 2022-10-22 16:53:55 81
en1 Английский Pluteum 2022-10-22 16:52:01 919 Initial revision (published)