From 08e93603a952f412f049c2c1155c21f772fbea8a Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 4 Feb 2018 09:45:01 +0000 Subject: [PATCH] preorder_tree_construction minor changes. --- .../training/preorder_tree_construction.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/puzzles/interviews/training/preorder_tree_construction.cpp b/puzzles/interviews/training/preorder_tree_construction.cpp index 0c6c347..e2c24ae 100644 --- a/puzzles/interviews/training/preorder_tree_construction.cpp +++ b/puzzles/interviews/training/preorder_tree_construction.cpp @@ -1,3 +1,8 @@ +/* +VIM: let b:lcppflags="-std=c++11 -O2 -pthread" +VIM: let b:wcppflags="/O2 /EHsc /DWIN32" +VIM: let b:argv="" +*/ #include #include #include @@ -15,7 +20,7 @@ struct node { }; node * prefix_to_tree( const std::vector& v ){ - + if ( !v.size() ){ return nullptr; } @@ -53,7 +58,6 @@ node * prefix_to_tree( const std::vector& v ){ } } - std::cout << root << std::endl; return root; } @@ -74,8 +78,9 @@ void traverse( node * root, std::vector& v ){ } void test( const std::vector& v ){ + std::cout << "-----------------------------------------------------" << std::endl; auto r = prefix_to_tree( v ); - //print( r ); + print( r ); std::vector w; traverse( r, w ); if ( v.size() != w.size() ) {