Some data structures — pointers or arrays?

Revision en4, by 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!

Tags data structures, pointers, arrays

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Pluteum 2022-10-22 16:59:50 133
en3 English Pluteum 2022-10-22 16:54:15 1 Tiny change: '209] and [[submissio' -> '209] and [submissio'
en2 English Pluteum 2022-10-22 16:53:55 81
en1 English Pluteum 2022-10-22 16:52:01 919 Initial revision (published)