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: codingonion (coderonion@gmail.com)
|
||||
*/
|
||||
|
||||
include!("../include/include.rs");
|
||||
use hello_algo_rust::include::print_util;
|
||||
|
||||
/* 冒泡排序 */
|
||||
fn bubble_sort(nums: &mut [i32]) {
|
||||
|
||||
@ -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]) {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Author: night-cruise (2586447362@qq.com)
|
||||
*/
|
||||
|
||||
include!("../include/include.rs");
|
||||
use hello_algo_rust::include::print_util;
|
||||
|
||||
/* 计数排序 */
|
||||
// 简单实现,无法用于排序对象
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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]) {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user