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: codingonion (coderonion@gmail.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 冒泡排序 */
fn bubble_sort(nums: &mut [i32]) {

View File

@ -4,7 +4,7 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 桶排序 */
fn bucket_sort(nums: &mut [f64]) {

View File

@ -4,7 +4,7 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 计数排序 */
// 简单实现,无法用于排序对象

View File

@ -4,7 +4,7 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 堆的长度为 n ,从节点 i 开始,从顶至底堆化 */
fn sift_down(nums: &mut [i32], n: usize, mut i: usize) {

View File

@ -4,7 +4,7 @@
* Author: xBLACKICEx (xBLACKICEx@outlook.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 插入排序 */
fn insertion_sort(nums: &mut [i32]) {

View File

@ -4,7 +4,7 @@
* Author: night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
fn digit(num: i32, exp: i32) -> usize {

View File

@ -4,7 +4,7 @@
* Author: WSL0809 (wslzzy@outlook.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
/* 选择排序 */
fn selection_sort(nums: &mut [i32]) {