Questions tagged [ropes]

A rope is a data structure used for storing and manipulating strings.

A rope (sometimes called a cord) uses binary trees to store strings.

When compared to a large character array, they allow for faster insertion and deletion of text compared to using a large array, and their memory does not need to be contiguous. However, the total memory requirements can be larger (because of the additional space required to store the tree) and additional complexity of code necessary to manage it.

References

Ropes on Wikipedia

25 questions
3
votes
1 answer

Matching regular expressions against non-Strings in Ruby without conversion

If a Ruby regular expression is matching against something that isn't a String, the to_str method is called on that object to get an actual String to match against. I want to avoid this behavior; I'd like to match regular expressions against objects…
Bkkbrad
  • 3,087
  • 24
  • 30
3
votes
2 answers

Trouble implementing a "rope" data structure in C++

I'm trying to make a rope data structure. It's a type of binary tree, i.e. a recursive data structure. The purpose of a rope is that splitting and concatenation should be fast, which means you avoid copying entire ropes. So, for example, a user…
user541686
  • 205,094
  • 128
  • 528
  • 886
2
votes
1 answer

Ropes: what's "large enough to benefit from cache effects"?

From Wikipedia: The main disadvantages are greater overall space usage and slower indexing, both of which become more severe as the tree structure becomes larger and deeper. However, many practical applications of indexing involve only…
Imagist
  • 18,086
  • 12
  • 58
  • 77
1
vote
1 answer

B+ tree where keys are the sum of its children

I've been attempting to make a B+ Tree where each key is the sum of the keys of the corresponding child. The leaves would then contain a string, and its key would be the strings length. I'm basically trying to make a B+ Tree Rope. Here is what I…
0
votes
1 answer

How is this rope implementation correct?

I was trying to solve a programming problem that involved a lot of insertions into a list. The specifics of the problem are not relevant to the question, however. To solve it, I ended up writing some kind of a rope data structure, trying to piece an…
0
votes
1 answer

Which Data structure used in Visual Studio Code

I know that Notepad++ used Gap Buffer, and XI editor used Rope. But I don't know which data structure behind the Visual Studio Code. Do you know which data structure used in Visual Studio Code?
Le Phong Vu
  • 156
  • 2
  • 12
0
votes
3 answers

How is the data stored in a textbox?

I was reading this paper "Ropes: an Alternative to Strings" about ropes [figure from the same paper] and I was wondering if that is the data structure used by today's browsers to implement textboxes or not. Do we use ropes or some other data…
Lazer
  • 90,700
  • 113
  • 281
  • 364
0
votes
1 answer

Rope data structure weights are characters in node plus weight of left subtree or both left and right subtrees?

Wikipedia entry says: Each node has a "weight" equal to the length of its string plus the sum of all the weights in its left subtree. Thus a node with two children divides the whole string into two parts: the left subtree stores the first part of…
Palace Chan
  • 8,845
  • 11
  • 41
  • 93
-1
votes
2 answers

How do I use the rope from C++ STL in Xcode

Apologies if I'm asking a silly newbie question. I'm new to C++ (familiar with C and objective C) and wanted to use the rope from the standard template library. Is this included with the libraries that Xcode uses? I have tried #include and…
John P
  • 625
  • 2
  • 7
  • 15
-3
votes
1 answer

How to declare Ropes in Java?

What are ropes in Java? How can you initialize them in Java as the replacement for Strings in Java? Why was this concept introduced?
1
2