Data Structures and Algorithms in Swift

Tác giả : Kevin Lau
  • Lượt đọc : 372
  • Kích thước : 4.64 MB
  • Số trang : 328
  • Đăng lúc : 2 năm trước
  • Số lượt tải : 216
  • Số lượt xem : 2.011
  • Đọc trên điện thoại :
The study of data structures is one about efficiency. Given a particular amount of data, what is the best way to store it to achieve a particular goal?
As a programmer, you regularly use a variety of collection types, such as arrays, dictionaries, and sets. These are data structures that hold a collection of data, each structure having its own performance characteristics.
As an example, consider the difference between an array and a set. Both are meant to hold a collection of elements, but trying to find a particular element in an array takes a lot longer than finding an element in a set. On the other hand, you can order the elements an array, but you can’t order the elements of a set.
Data structures are a well-studied area, and the concepts are language agnostic; a data structure from C is functionally and conceptually identical to the same data structure in any other language, such as Swift. At the same time, the high-level expressiveness of Swift make it an ideal choice for learning these core concepts without sacrificing too much performance.
So why should you learn data structures and algorithms?