Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active April 27, 2018 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/8b14a89beda6779b07ac5783c630e0d9 to your computer and use it in GitHub Desktop.
Save deque-blog/8b14a89beda6779b07ac5783c630e0d9 to your computer and use it in GitHub Desktop.
// O(n) complexity
std::advance(linkedList.begin(), n);
// O(1) complexity (taking advantage of random access iterator)
std::advance(vector.begin(), n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment