ropes

What is the concatenation complexity of balanced ropes?

眉间皱痕 提交于 2020-01-01 10:14:14
问题 I've looked at different papers and here is the information that I've gathered: SGI implementation and C cords neither guarantee O(1) time concatenation for long ropes nor ~log N depth for shorter ones. Different sources contradict each other. Wikipedia claims O(1) concatenation. This page says that concatenation is O(1) only when one operand is small and O(log N) otherwise. So, what is the time complexity of concatenation? When exactly rebalancing is performed to ensure this concatenation

What is the concatenation complexity of balanced ropes?

。_饼干妹妹 提交于 2019-12-04 06:24:59
I've looked at different papers and here is the information that I've gathered: SGI implementation and C cords neither guarantee O(1) time concatenation for long ropes nor ~log N depth for shorter ones. Different sources contradict each other. Wikipedia claims O(1) concatenation. This page says that concatenation is O(1) only when one operand is small and O(log N) otherwise. So, what is the time complexity of concatenation? When exactly rebalancing is performed to ensure this concatenation complexity while maintaining tree balance? Are some specific usage patterns assumed when talking about

Trouble implementing a “rope” data structure in C++

老子叫甜甜 提交于 2019-12-04 04:18:10
问题 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 should be able to say rope1 + rope2 and expect a result in ~logarithmic time. However, this presents a problem: If a rope is modified, its parents are indirectly modified as well. Because my goal is to make rope a drop-in replacement for string ,

Public implementation of ropes in C#?

风流意气都作罢 提交于 2019-12-03 08:20:05
问题 Is there a public implementation of the Rope data structure in C#? 回答1: For what its worth, here is an immutable Java implementation. You could probably convert it to C# in less than an hour. 回答2: I'm not aware of a Rope implementation (though there probably is one!), but if you're only after doing concatenation, StringBuilder will do the job. 回答3: The BigList<T> class from Wintellect Power Collections (a C# data structure library) is somehow similar to rope: http://docs.pushtechnology.com

Public implementation of ropes in C#?

…衆ロ難τιáo~ 提交于 2019-12-02 20:59:26
Is there a public implementation of the Rope data structure in C#? For what its worth, here is an immutable Java implementation . You could probably convert it to C# in less than an hour. I'm not aware of a Rope implementation (though there probably is one!), but if you're only after doing concatenation, StringBuilder will do the job. The BigList<T> class from Wintellect Power Collections (a C# data structure library) is somehow similar to rope: http://docs.pushtechnology.com/docs/4.5.7/dotnet/externalclient/html/class_wintellect_1_1_power_collections_1_1_big_list_3_01_t_01_4.html I measured

Is there any scenario where the Rope data structure is more efficient than a string builder

。_饼干妹妹 提交于 2019-11-28 05:24:26
Related to this question , based on a comment of user Eric Lippert . Is there any scenario where the Rope data structure is more efficient than a string builder? It is some people's opinion that rope data structures are almost never better in terms of speed than the native string or string builder operations in typical cases, so I am curious to see realistic scenarios where indeed ropes are better. The documentation for the SGI C++ implementation goes into some detail on the big O behaviours verses the constant factors which is instructive. Their documentation assumes very long strings being

STL Rope - when and where to use

倾然丶 夕夏残阳落幕 提交于 2019-11-27 03:57:13
I was wondering under what circumstances you would use a rope over another STL container? Ropes are a scalable string implementation: they are designed for efficient operation that involve the string as a whole. Operations such as assignment, concatenation, and substring take time that is nearly independent of the length of the string. Unlike C strings, ropes are a reasonable representation for very long strings such as edit buffers or mail messages. Advantages : Much faster concatenation and substring operations involving long strings. Inserting a character in the middle of a 10 megabyte rope

Is there any scenario where the Rope data structure is more efficient than a string builder

回眸只為那壹抹淺笑 提交于 2019-11-27 00:59:15
问题 Related to this question, based on a comment of user Eric Lippert. Is there any scenario where the Rope data structure is more efficient than a string builder? It is some people's opinion that rope data structures are almost never better in terms of speed than the native string or string builder operations in typical cases, so I am curious to see realistic scenarios where indeed ropes are better. 回答1: The documentation for the SGI C++ implementation goes into some detail on the big O

STL Rope - when and where to use

爱⌒轻易说出口 提交于 2019-11-26 12:41:12
问题 I was wondering under what circumstances you would use a rope over another STL container? 回答1: Ropes are a scalable string implementation: they are designed for efficient operation that involve the string as a whole. Operations such as assignment, concatenation, and substring take time that is nearly independent of the length of the string. Unlike C strings, ropes are a reasonable representation for very long strings such as edit buffers or mail messages. Advantages : Much faster