Write A Function To Deeply Copy/Clone All Values Question, programming homework help
Write A Function To Deeply Copy/Clone All Values Question, programming homework help
Question:
a) Write a function to ‘deeply clone’, i.e. fully copy, all values of a ternary search tree as defined as follows:
typedef struct tstnode_int *tstnode;
struct tstnode_int
{
void *data;
tstnode left;
tstnode centre;
tstnode right;
};
typedef struct ternstree_int {tstnode root;} *ternstree;
You should return the copy — your function should have the following header:
ternstree clone(ternstree t, void *(*copyData)(void *));
b) Using the same information in part (a), if you were to add an array (tstnode array[]) into the struct above, how would you go about deeply copying/cloning this as well? Write a new function to show this (you can re-use your answer from part (a) but clearly show what you’ve added for this question).
c) Using the same information in part (a), if you were to change void *data; to void data;(remove the *) from the question above, what difference would this make to the overall question? Write a new function to show this.
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


