summaryrefslogtreecommitdiff
path: root/datastructures
diff options
context:
space:
mode:
authorPaul Jungeblut <paul.jungeblut@gmail.com>2017-03-19 15:58:59 +0100
committerPaul Jungeblut <paul.jungeblut@gmail.com>2017-03-19 15:58:59 +0100
commit52cae605f443e7b3e165ddcdd880d5c8e5fff835 (patch)
treea6fb7bb489b0808f22b6768ce81eee9b4b32c8da /datastructures
parent47c7fa753df448801794aba14ec56a491fc4f389 (diff)
Slight changes to suffix tree and adding implicit cartesian STL tree.
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++) {...}