algorithm_rust 0.6.0

some common rust_algorithms, Everyone can participate, and the project will continue to be updated, all the algorithms comes from <Introduction to Algorithms III>
Documentation
/// 链表节点
#[derive(Debug)]
pub struct Node<T> {
    pub value: T,
    pub next: Option<Box<Node<T>>>,
}

/// 链表
/// # Examples
/// ```
/// use algori::structure::LinkedList;
///let mut a:LinkedList<i32> = LinkedList::new(); ///创建一个i32的链表
///for i in 0..101 { ///插入100个节点
/// a.push(i);
///}
///let b = a.search(&9);
///println!("{:?}",b);
///```
pub struct LinkedList<T> {
    pub head: Option<Box<Node<T>>>,
}

impl<T: std::cmp::PartialEq> LinkedList<T> {
    /// 创建一个新的空链表
    pub fn new() -> Self {
        LinkedList { head: None }
    }

    /// 在链表头部插入一个新节点
    pub fn push(&mut self, value: T) {
        let new_node = Node {
            value: value,
            next: self.head.take(),
        };
        self.head = Some(Box::new(new_node));
    }

    /// 移除并返回链表头部的节点
    pub fn pop(&mut self) -> Option<T> {
        self.head.take().map(|node| {
            self.head = node.next;
            node.value
        })
    }

    /// 返回链表头部节点的引用
    pub fn peek(&self) -> Option<&T> {
        self.head.as_ref().map(|node| &node.value)
    }

    /// 检查链表是否为空
    pub fn is_empty(&self) -> bool {
        self.head.is_none()
    }
    ///链表搜索,返回指针
    pub fn search(&self, value: &T) -> Option<&Node<T>> {
        let mut current = &self.head;
        while let Some(node) = current {
            if &node.value == value {
                return Some(node);
            }
            current = &node.next;
        }
        None
    }
}