From 4e2c3eaa16e98cd518b1f8917956359813e281a7 Mon Sep 17 00:00:00 2001 From: GustavoMeza Date: Wed, 1 May 2019 13:19:29 -0500 Subject: [PATCH] linked list --- linked-list.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 linked-list.cpp diff --git a/linked-list.cpp b/linked-list.cpp new file mode 100644 index 0000000..945332e --- /dev/null +++ b/linked-list.cpp @@ -0,0 +1,9 @@ +vector nxt, prv; +void list_init(int n) { + nxt.clear(); nxt.assign(n+1,n); + prv.clear(); prv.assign(n+1,n); +} +void list_erase(int node) { + nxt[prv[node]] = nxt[node]; + prv[nxt[node]] = prv[node]; +}