Question: THE ANSWER SHOULD BE IN C# PROGRAMMING LANGUAGE Requirements Your task is to design, implement, test, and document the following methods for the Rope class.

THE ANSWER SHOULD BE IN C# PROGRAMMING LANGUAGE

THE ANSWER SHOULD BE IN C# PROGRAMMING LANGUAGE Requirements Your task isto design, implement, test, and document the following methods for the Rope

Requirements Your task is to design, implement, test, and document the following methods for the Rope class. The notation S[i,j] is used to represent the substring that begins at index i and ends at index j. Assume as well that the maximum size of a leaf substring is 10. Rope(): Create an empty rope (1 mark). Rope(string S) : Create a balanced rope from a given string S (8 marks). Rope Concatenate(Rope R1, Rope R2): Return the concatenation of ropes Rl and R2 (4 marks). void Split(int i, Rope R1, Rope R2): Return the two ropes split at index i (10 marks). void Insert(string S, int i) : Insert string S at index i (6 marks). Review the C# library class for string. void Delete(int i, int j) : Delete the substring S[i, j] (6 marks). string Substring(int i, int i) : Return the substring S[i, j] (8 marks). char CharAt(int i) : Return the character at index i (4 marks). int IndexOf(char c) : Return the index of the first occurrence of character c (4 marks). void Reverse(): Reverse the string represented by the current rope (6 marks). int Length(): Return the length of the string (1 mark). string ToString(): Return the string represented by the current rope (4 marks). void PrintRope() : Print the augmented binary tree of the current rope (4 marks). Optimizations The ideal rope maintains a height of O(log n), but that can be quite a challenge. To help limit the height of the tree, try to implement the following optimizations. 1. After a Split, compress if possible the path back to the root (4 marks). 2. Combine left and right siblings whose total string length is 5 or less (4 marks). 3. Rebalance the rope periodically (4 marks). D E H Hello my K N 4. 1 na me i Simon Requirements Your task is to design, implement, test, and document the following methods for the Rope class. The notation S[i,j] is used to represent the substring that begins at index i and ends at index j. Assume as well that the maximum size of a leaf substring is 10. Rope(): Create an empty rope (1 mark). Rope(string S) : Create a balanced rope from a given string S (8 marks). Rope Concatenate(Rope R1, Rope R2): Return the concatenation of ropes Rl and R2 (4 marks). void Split(int i, Rope R1, Rope R2): Return the two ropes split at index i (10 marks). void Insert(string S, int i) : Insert string S at index i (6 marks). Review the C# library class for string. void Delete(int i, int j) : Delete the substring S[i, j] (6 marks). string Substring(int i, int i) : Return the substring S[i, j] (8 marks). char CharAt(int i) : Return the character at index i (4 marks). int IndexOf(char c) : Return the index of the first occurrence of character c (4 marks). void Reverse(): Reverse the string represented by the current rope (6 marks). int Length(): Return the length of the string (1 mark). string ToString(): Return the string represented by the current rope (4 marks). void PrintRope() : Print the augmented binary tree of the current rope (4 marks). Optimizations The ideal rope maintains a height of O(log n), but that can be quite a challenge. To help limit the height of the tree, try to implement the following optimizations. 1. After a Split, compress if possible the path back to the root (4 marks). 2. Combine left and right siblings whose total string length is 5 or less (4 marks). 3. Rebalance the rope periodically (4 marks). D E H Hello my K N 4. 1 na me i Simon

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!