What error i did in this code showing segmentation fault?
hi @kailash_01
you error is
for(int i=0;i<m;i++){
new_root=deletehtenode(root,a[i]);
}
preorder_print(new_root);
don;t use two roots
corect one is
for(int i=0;i<m;i++){
root=deletehtenode(root,a[i]);
}
preorder_print(root);
this is because when root node is deleted then
new_root will change but root will not change and you are passing root so this will give segmentation fault because now root is not present
i hope this will help you