mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-04 19:20:52 +08:00
Refine some details and coding style for Rust codes (#344)
* Refine some details and coding style for Rust codes * Update coding style for Rust codes * Update time_complexity.rs * Update array.rs * Update leetcode_two_sum.rs * Update hash_map.rs * Update file headers * Update coding style for Rust codes and Zig codes * Update coding style for Rust codes and Zig codes --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
/*
|
||||
* File: queue.rs
|
||||
* Created Time: 2023-02-05
|
||||
* Author: sjinzh (sjinzh@gmail.com)
|
||||
*/
|
||||
*/
|
||||
|
||||
include!("../include/include.rs");
|
||||
|
||||
use std::collections::LinkedList;
|
||||
|
||||
@@ -18,7 +20,7 @@ pub fn main() {
|
||||
queue.push_back(5);
|
||||
queue.push_back(4);
|
||||
print!("队列 queue = ");
|
||||
inc::print_util::print_queue(&queue);
|
||||
print_util::print_queue(&queue);
|
||||
|
||||
// 访问队首元素
|
||||
let peek = queue.front().unwrap();
|
||||
@@ -27,13 +29,13 @@ pub fn main() {
|
||||
// 元素出队
|
||||
let poll = queue.pop_front().unwrap();
|
||||
print!("出队元素 poll = {poll},出队后 queue = ");
|
||||
inc::print_util::print_queue(&queue);
|
||||
print_util::print_queue(&queue);
|
||||
|
||||
// 获取队列的长度
|
||||
let size = queue.len();
|
||||
print!("\n队列长度 size = {size}");
|
||||
|
||||
/* 判断队列是否为空 */
|
||||
// 判断队列是否为空
|
||||
let is_empty = queue.is_empty();
|
||||
print!("\n队列是否为空 = {is_empty}");
|
||||
}
|
||||
Reference in New Issue
Block a user