idomatic structure rust code, no include macro (#1528)

This commit is contained in:
rongyi
2024-10-23 18:49:47 +08:00
committed by GitHub
parent 0c60037e56
commit ef3010bd77
47 changed files with 57 additions and 80 deletions

View File

@ -4,7 +4,7 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::{print_util, tree_node};
/* 数组表示下的二叉树类 */
struct ArrayBinaryTree {

View File

@ -4,12 +4,11 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::{print_util, TreeNode};
use std::cell::RefCell;
use std::cmp::Ordering;
use std::rc::Rc;
use tree_node::TreeNode;
type OptionTreeNodeRc = Option<Rc<RefCell<TreeNode>>>;

View File

@ -4,13 +4,13 @@
* Author: xBLACKICEx (xBLACKICE@outlook.com)、night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
use std::cell::RefCell;
use std::cmp::Ordering;
use std::rc::Rc;
use tree_node::TreeNode;
use hello_algo_rust::include::TreeNode;
type OptionTreeNodeRc = Option<Rc<RefCell<TreeNode>>>;

View File

@ -4,8 +4,7 @@
* Author: xBLACKICEx (xBLACKICE@outlook.com)
*/
use std::rc::Rc;
include!("../include/include.rs");
use tree_node::TreeNode;
use hello_algo_rust::include::{print_util, TreeNode};
/* Driver Code */
fn main() {

View File

@ -4,11 +4,11 @@
* Author: xBLACKICEx (xBLACKICE@outlook.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::{print_util, vec_to_tree, TreeNode};
use hello_algo_rust::op_vec;
use std::collections::VecDeque;
use std::{cell::RefCell, rc::Rc};
use tree_node::{vec_to_tree, TreeNode};
/* 层序遍历 */
fn level_order(root: &Rc<RefCell<TreeNode>>) -> Vec<i32> {

View File

@ -4,11 +4,11 @@
* Author: xBLACKICEx (xBLACKICE@outlook.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::{vec_to_tree, TreeNode, print_util};
use hello_algo_rust::op_vec;
use std::cell::RefCell;
use std::rc::Rc;
use tree_node::{vec_to_tree, TreeNode};
/* 前序遍历 */
fn pre_order(root: Option<&Rc<RefCell<TreeNode>>>) -> Vec<i32> {