Start chapter 2, switch to ng-backed build.
This commit is contained in:
parent
fb22f6491b
commit
01c669d914
|
@ -166,6 +166,12 @@ Run times come in three flavours:
|
|||
might be a doubly-linked list with the iteration direction determined by
|
||||
distance from the centre, though this comes at the cost of additional
|
||||
complexity. The same improvements would apply to remove.
|
||||
|
||||
On a randomised benchmark (random operation, random value, random index),
|
||||
the array-backed list still outperforms a from-scratch linked list and
|
||||
an STL vector wrapper. The linked list performs the worst, with wildly
|
||||
varying run times.
|
||||
|
||||
2. For the sorted list, a basic improvement for find would be to pick the
|
||||
middle of the list and do an equality check, basically bisecting to
|
||||
find where the value *would* be.
|
|
@ -0,0 +1,15 @@
|
|||
# Chapter 2 (Array-based lists)
|
||||
|
||||
These data structures have common advantages and limitations:
|
||||
|
||||
* constant-time access
|
||||
|
||||
* resizing the array adds potentially non-trivial complexity, both in time and
|
||||
storage, as a new array generally must be created and the old array copied
|
||||
over.
|
||||
|
||||
* arrays aren't dynamic, which means inserting or deleting in the middle of an
|
||||
array requires shifting all the following elements.
|
||||
|
||||
With some careful management, the additional *amortised* complexity added by
|
||||
resizing isn't too bad.
|
|
@ -1,6 +1,6 @@
|
|||
compilers:
|
||||
cxx: clang++-5.0
|
||||
ld: clang++-5.0
|
||||
cxx: clang++
|
||||
ld: clang++
|
||||
|
||||
targets:
|
||||
cc:
|
||||
|
|
Loading…
Reference in New Issue