krahets / hello-algo

《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing
https://hello-algo.com
Other
93.88k stars 11.89k forks source link

Array and List in Rust #1328

Closed CarrotDLaw closed 3 months ago

CarrotDLaw commented 3 months ago

The Rust codes in Chapter 4.1 Array and Chapter 4.3 List both use vector instead of array. Like the approaches of other languages like C++ and Java, the code in Chapter 4.1 Array should use array to differentiate the concept of array and list.

For example, in Chapter 4.1.1 Initializing Arrays,

let nums: [i32; 5] = [1, 2, 3, 4, 5];

instead of

let nums: Vec<i32> = vec![1, 3, 2, 5, 4];
krahets commented 3 months ago

I agree. Would you like to help update the Rust implementation(both in codes/rust and docs/) for "4.1 array" by submitting a PR? Thx!

CarrotDLaw commented 3 months ago

For sure, I would like to help! I will start in the coming weeks.