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

You have 10 seconds to implement std::vector in plain C

Name: Anonymous 2016-07-20 3:56

Must support:

* Adding elements
* Regrowing

Name: Anonymous 2016-08-03 16:48

>>35

You can also use it as a singly linked list, with each cell containing a pointer to its data and a pointer to the next cell.

https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Cons-cells.svg/350px-Cons-cells.svg.png

You can also use it to implement a limited form of binary tree, where only the leaves store values. For example you could have Cell A containing pointers to Cell B and C, and cells B and C each containing pointers to two data objects.

A "true" binary tree however would require at least three pointers per cell, one to store data and two to point to other cells.

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