daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. typedef int nodetypet;
  4. #include "opcenitoP.h"
  5. typedef nodet elementtypeq;
  6. using namespace std;
  7.  
  8.  
  9. void obrisi(tree &T, nodet n){
  10.        
  11. }
  12.  
  13. void PrO(tree &T, nodet n){
  14.    
  15.     cout << n -> label << ", ";
  16.     if (FirstChildT(T, n) != lambdat)
  17.         PrO(T, FirstChildT(T, n));
  18.     if (NextSiblingT(T, n) != lambdat)
  19.         PrO(T, NextSiblingT(T, n));
  20. }
  21.  
  22. void Preorder(tree &T) {
  23.     PrO(T, RootT(T));
  24. }
  25.  
  26. int main(){
  27.     nodet n;
  28.     tree T;
  29.    
  30.    
  31.     InitT(T, 4);
  32.     n=RootT(T);
  33.    
  34.     CreateChildT(T, n, 7);
  35.     CreateChildT(T, n, 6);
  36.     CreateChildT(T, n, 8);
  37.    
  38.     n=FirstChildT(T,n);
  39.     CreateChildT(T, n, 2);
  40.     CreateChildT(T, n, 8);
  41.    
  42.     n=FirstChildT(T, n);
  43.     CreateChildT(T, n, 3);
  44.    
  45.     n=NextSiblingT(T, n);
  46.     CreateChildT(T, n, 1);
  47.    
  48.     n=ParentT(T,n);
  49.     n=NextSiblingT(T, n);
  50.     n=NextSiblingT(T, n);
  51.     CreateChildT(T, n, 5);
  52.    
  53.     n=FirstChildT(T, n);
  54.     CreateChildT(T, n, 9);
  55.     CreateChildT(T, n, 2);
  56.  
  57.     Preorder(T);   
  58. }
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