programmer group

Notes on data structure Deng Junhui of Tsinghua University Chapter 2

Chapter 2 vector VectorIt is an abstraction and generalization of linear array. Starting from the most basic interface of vector, the corresponding vector template class is designed and implemented. a. Operation interface supported by vector ADT Operation interface function Applicable objects size() The current size of the report vector (total number of elements) vector get(r) Get the element of rank R vector put(r,...

programmer group

Trust learning - using vectors to store value list

Vectors allow us to store multiple values in a single data structure, which places all values adjacent to each other in memory. Vectors can only store values of the same type. They are useful when we have a list of items, such as lines of text in a file or prices for items in a shopping cart. Create a new vector fn main() { let v: Vec<i32> = Vec::new(); println!("{:?}", v) } D:\learn\cargo_learn>cargo run Compiling...