SHARE
TWEET

dio myal

a guest May 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. void bstRecPreOrderMap(BSTNode* radice, MapFun op,void* _ )
  3. {
  4.     op(radice->data,_);
  5.  
  6.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,_);
  7.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,_);
  8. }
  9. void bstRecInOrderMap(BSTNode* radice, MapFun op,void* _ )
  10. {
  11.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,_);
  12.     op(radice->data,_);
  13.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,_);
  14. }
  15. void bstRecPostOrderMap(BSTNode* radice, MapFun op,void* _ )
  16. {
  17.    
  18.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,_);
  19.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,_);
  20.  
  21.     op(radice->data,_);
  22. }
  23. void bstRecBreadthMap(BSTNode* radice, MapFun op,void* _ )
  24. {
  25.     printf("\n non disponibile per le ricorsioni");
  26. }
  27.  
  28. /* ******************************************************* */
  29.  
  30. void bstRecPreOrderFold(BSTNode* radice,FoldFun op , void* par,void* _ )
  31. {
  32.     op(radice->data,par,_);
  33.  
  34.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,par,_);
  35.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,par,_);
  36. }
  37. void bstRecInOrderFold(BSTNode* radice,FoldFun op , void* par,void* _ )
  38. {
  39.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,par,_);
  40.     op(radice->data,par,_);
  41.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,par,_);
  42. }
  43. void bstRecPostOrderFold(BSTNode* radice,FoldFun op , void* par,void* _ )
  44. {
  45.    
  46.     if(radice->sx)bstRecPreOrderMap(radice->sx,op,par,_);
  47.     if(radice->dx)bstRecPreOrderMap(radice->dx,op,par,_);
  48.  
  49.     op(radice->data,par,_);
  50. }
  51. void bstRecBreadthFold(BSTNode* radice,FoldFun op , void* par,void* _ )
  52. {
  53.     printf("\nnon disponibile per la ricorsione");
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top