Linked list vs. dynamic array for implementing a stack

后端 未结 5 1107
再見小時候
再見小時候 2020-12-24 13:02

I\'ve started reviewing data structures and algorithms before my final year of school starts to make sure I\'m on top of everything. One review problem said \"Implement a s

5条回答
  •  攒了一身酷
    2020-12-24 13:41

    What matters is the number of times malloc() gets called in the course of running a task. It could take from hundreds to thousands of instructions to get you a block of memory. (The time in free() or GC should be proportional to that.) Also, keep a sense of perspective. This might be 99% of the total time, or only 1%, depending what else is happening.

提交回复
热议问题