preorder_tree_construction minor changes.

This commit is contained in:
2018-02-04 09:45:01 +00:00
parent d32fb7a220
commit 08e93603a9

View File

@@ -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 <vector>
#include <string>
#include <iostream>
@@ -15,7 +20,7 @@ struct node {
};
node * prefix_to_tree( const std::vector<double>& v ){
if ( !v.size() ){
return nullptr;
}
@@ -53,7 +58,6 @@ node * prefix_to_tree( const std::vector<double>& v ){
}
}
std::cout << root << std::endl;
return root;
}
@@ -74,8 +78,9 @@ void traverse( node * root, std::vector<double>& v ){
}
void test( const std::vector<double>& v ){
std::cout << "-----------------------------------------------------" << std::endl;
auto r = prefix_to_tree( v );
//print( r );
print( r );
std::vector<double> w;
traverse( r, w );
if ( v.size() != w.size() ) {