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.

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.