- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hi! (Smile)
We are given two sets $S_1$ and $S_2$.
We consider that $S_1$ is implemented, using a sorted list, and $S_2$ is implemented, using a pre-order sorted tree.
I have to write a pseudocode, that implements the operation Merge() of the sets $S_1$ and $S_2$.
The time complexity of the algorithm should be $O(n_1+n_2)$, where $n_1$ is the number of elements of $S_1$ and $n_2$ is the number of elements of $S_2$.Could you give me a hint, how we could do this? (Thinking)
We are given two sets $S_1$ and $S_2$.
We consider that $S_1$ is implemented, using a sorted list, and $S_2$ is implemented, using a pre-order sorted tree.
I have to write a pseudocode, that implements the operation Merge() of the sets $S_1$ and $S_2$.
The time complexity of the algorithm should be $O(n_1+n_2)$, where $n_1$ is the number of elements of $S_1$ and $n_2$ is the number of elements of $S_2$.Could you give me a hint, how we could do this? (Thinking)