Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The rope data structure

I was reading about the rope data structure.I am interested in building a text editor using C++ and Qt. My question is: Does built-in string manipulating functions in programming languages like C++ use the rope data structure? Or do I need to write my own code for implementing ropes so that I can perform string operations like concatenation and deletion more efficiently?

like image 275
sudeepdino008 Avatar asked Sep 22 '12 15:09

sudeepdino008


People also ask

Where is rope data structure used?

A Rope data structure is a tree data structure which is used to store or manipulate large strings in a more efficient manner. It allows for operations like insertion, deletion, search and random access to be executed faster and much more efficiently in comparison to a traditional String.

What is string data structure?

A string is generally considered as a data type and is often implemented as an array data structure of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding. String may also denote more general arrays or other sequence (or list) data types and structures.

What are the 4 data structures?

When we think of data structures, there are generally four forms: Linear: arrays, lists. Tree: binary, heaps, space partitioning etc. Hash: distributed hash table, hash tree etc.


1 Answers

std::string is not a rope, but SGI STL provides rope.

If you plan on implementing your own rope, I'd recommend SGI's rope implementation overview for some implementation details.

like image 187
Peter Alexander Avatar answered Oct 21 '22 20:10

Peter Alexander