summaryrefslogtreecommitdiff
path: root/datastructures
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures')
-rw-r--r--datastructures/datastructures.tex3
-rw-r--r--datastructures/stlRope.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/datastructures/datastructures.tex b/datastructures/datastructures.tex
index 4267090..9018cd5 100644
--- a/datastructures/datastructures.tex
+++ b/datastructures/datastructures.tex
@@ -17,3 +17,6 @@ Dazu: Offset in den inneren Knoten des Baums speichern.
\subsection{STL-Tree}
\lstinputlisting{datastructures/stlTree.cpp}
+
+\subsection{STL-Rope}
+\lstinputlisting{datastructures/stlRope.cpp}
diff --git a/datastructures/stlRope.cpp b/datastructures/stlRope.cpp
new file mode 100644
index 0000000..9179a60
--- /dev/null
+++ b/datastructures/stlRope.cpp
@@ -0,0 +1,8 @@
+#include <ext/rope>
+using namespace __gnu_cxx;
+rope<int> v; // Wie normaler Container.
+v.push_back(num); // O(log(n))
+rope<int> sub = v.substr(start, length); // O(log(n))
+v.erase(start, length); // O(log(n))
+v.insert(v.mutable_begin() + offset, sub); // O(log(n))
+for(auto it = v.mutable_begin(); it != v.mutable_end(); it++) {...}