Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C: linked lists or dynamic arrays?

Name: Anonymous 2011-04-07 20:56

As a general rule, should C programs use linked lists or dynamic arrays?

Name: Anonymous 2011-04-07 21:13

The dynamic array has faster indexing - array to list, O(1) versus O(n) - but the linked list performs faster insertions at the front - array to list, O(n) versus O(1) - and insertions in the middle - array to list, search time + O(1) versus O(n).  Some of these speed concerns can be mitigated by using a variant of a standard dynamic array.

As a general rule, your program should use whatever is the best implementation for your intentions.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List