mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
idomatic structure rust code, no include macro (#1528)
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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>>>;
|
||||
|
||||
|
||||
@ -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>>>;
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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> {
|
||||
|
||||
@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user