Question: Problem 4. Consider binary strings (sequences of zeros and ones). P4.1. Design a data structure BSSET that can be used to represent sets of binary

Problem 4. Consider binary strings (sequences of zeros and ones). P4.1. Design a data structure BSSET that can be used to represent sets of binary strings such that any binary string W of length W=N can be added or removed in N and such that one can check whether W is in the data structure in N. Sketch why your data structure BSSET supports the stated operations in N. P4.2. Let W of length W=N be a binary string and let S be a BSSET set. Provide an algorithm that prints all strings VS that start with the prefix W (the first W characters of S are equivalent to W ). Your algorithm should have a worst-case complexity of N+k in which k is the number of characters printed to the output. P4.3. Professor X claims to have developed a data structure BSSETX to which any binary string W of length W=N can be added in N. Furthermore, Professor X claims that BSSETX provides ordered iteration: one can iterate over all M=S strings in a set S, implemented via BSSETX, in a lexicographical order in M+T in which T is the combined length of the M strings. Professor X claims that this method of sorting binary strings proves that the worst-case lower bound for sorting M binary strings is not Mlog2(M) comparisons. Argue why Professor X is wrong. We note that strings S1 and S2 are lexicographical ordered, denoted by S1S2, if S1 comes before S2 in an alphabetical sort (e.g., as used in a dictionary). Next, we formalize S1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
