数据结构与算法一:开篇

《Data Structures & Algorithms in Swift》 翻译工作正式开始了!

今天是对这本书翻译的第一天,不要着急,接下来会慢慢把这本书翻译完,并发布在这一系列文章。欢迎大家多多关注、支持。

因为花费了大量时间和精力,为了产出更好的服务,后面的部分章节选择性收费,望理解。

想了解更多信息,可以关注一下我的个人技术公众号 – 「北之星」。

为何要学习数据结构与算法?

数据结构研究的是效率。

假如给我们特定数量的数据,存储它或者操作它,以实现特定目标的最佳方式是什么呢?

程序员们要经常使用各种集合类型,比如数组、字典和集合。这些集合就是保存数据的数据结构,每种结构都有各自的特性。

例如,数组(array)与集合(set),两者都是旨在保存元素的集合,但在 array 中搜索元素比在 set 中搜索元素花费的时间要长得多。另外,我们可以对 array 中的元素进行排序,但不能对 set 的元素进行排序。

数据结构是一门经过充分研究的学科,其概念与语言无关。C 中的数据结构在功能和概念上与其它语言(例如 Swift)中的同一数据结构相同。

Swift 作为新兴的、高效的一门高级语言,使用 Swift 实践数据结构与算法,是学习数据结构与算法的一个不错选择。本书选用 Swift 作为开发语言。

算法是完成某种任务的一组操作。它可以是一种排序算法,可以是一种将 8K 图片压缩到更小大小的算法。算法对于软件来说是必不可少的,无数聪明的前辈们已经为我们创建了很多优秀的算法,我们可以根据需要选用。

学习数据结构和算法的好处

面试

大多数公司都会考试算法以此测试你作为工程师的能力。数据结构和算法的坚实基础是许多软件工程职位的“门槛”。

工作

在处理大数据时,选择恰当的数据结构至关重要。

使用正确的算法对软件的性能和可扩展性起着重要作用。好的算法可以使我们的 app 响应速度更快,使电池寿命更长,可以用更少的资源处理更多的并发。

使用正确的数据结构,还可以使我们的代码可读性更强。例如,当我们在代码中看到 Set,马上就可以推断:

Set 的消费者不关心元素的顺序,因为 Set 是一个无序的集合
Set 确保没有重复值,因为我们可以假设消费者正在使用无重复的数据
Set 非常适合检查值成员关系,因此工程师可能是为此目的而使用了 Set
一旦熟悉了各种数据结构,我们就可以使用它从代码中获取额外的信息。这是一项强大的技能,可以帮助我们了解软件的工作原理。

自我提升

了解算法用于解决棘手问题的策略,可以帮助我们对代码进行改进。 Swift 标准库有一小组通用的集合类型,虽然它们并不涵盖所有情况, 然而这些原语(primitives)是构建复杂的抽象的一个很好的起点。

了解比标准 array 和 dictionary 更多的数据结构可以为我们提供更多构建 apps 的工具。

一位智者曾经说过:算法的练习类似于音乐家练习音阶。你的基础越完善,你就越能更好地使用更复杂的软件。
本书目标

接下来注重讲解以下几块儿内容:

介绍(Introduction)
基本数据结构(Elementary data structures)
树(Trees)
排序(Sorting)
图(Graphs)
这本书最好按先后顺序阅读,但如果你想跳着读也可以。

如果你还不熟悉算法和数据结构,在学习的过程中,可能会觉得其中有些知识点具有挑战性,但不用担心,如果你能够坚持到最后,你将很快成为一名 Swift 数据结构和算法大师。

千里之行始于足下,让我们从现在开始吧!

2022.05.28
上海 二联

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Learn data structures and algorithms in Swift! Understanding how data structures and algorithms work in code is crucial for creating efficient and scalable apps. Swift’s Standard Library has a small set of general purpose collection types, yet they definitely don’t cover every case! In this book, you’ll learn how to implement the most popular and useful data structures, and when and why you should use one particular data structure or algorithm over another. This set of basic data structures and algorithms will serve as an excellent foundation for building more complex and special-purpose constructs. As well, the high-level expressiveness of Swift makes it an ideal choice for learning these core concepts without sacrificing performance. Who This Book Is For This book is for developers who are comfortable with Swift and want to ace whiteboard interviews, improve the performance of their code, and ensure their apps will perform well at scale. Topics Covered in Data Structures & Algorithms in Swift * Basic structures: Start with the fundamental structures of linked lists, queues and stacks, and see how to implement them in a highly Swift-like way. * Trees: Learn how to work with various types of trees, including general purpose trees, binary trees, AVL trees, binary search trees, and tries. * Sorting: Go beyond bubble and insertion sort with better-performing algorithms, including mergesort, radix sort, heap sort, and quicksort. * Graphs: Learn how to construct directed, non-directed and weighted graphs to represent many real-world models. * Traversals: Traverse graphs and trees efficiently with breadth-first, depth-first, Dijkstra’s and Prim’s algorithms to solve problems such as finding the shortest path or lowest cost in a network. * And much, much more! By the end of this book, you’ll have hands-on experience solving common issues with data structures and algorithms — and you’ll be well on your way to developing your own efficient and useful implementations!
Swift Data Structure and Algorithms by Erik Azar English | 18 Nov. 2016 | ISBN: 1785884506 | 286 Pages | AZW3/MOBI/EPUB/PDF (conv) | 22.7 MB Master the most common algorithms and data structures, and learn how to implement them efficiently using the most up-to-date features of Swift 3 About This Book Develop a deep understanding of the collections in the Swift Standard Library with this step-by-step guide Develop native Swift data structures and algorithms for use in mobile, desktop, and server-based applications Learn about performance efficiency between different data structures and algorithms Who This Book Is For This book is for developers who want to learn how to implement and use common data structures and algorithms natively in Swift. Whether you are a self-taught developer without a formal technical background or you have a degree in Computer Science, this book will provide with the knowledge you need to develop advanced data structures and algorithms in Swift using the latest language features. What You Will Learn Get to know about the basic data structures and how to use the Swift REPL Use the Swift Standard Library collections bridging to Objective-C collections, and find out about protocol-oriented programming Find out about Swift generators and sequences, and see how to use them to implement advanced data structures such as Stack, StackList, Queue, and LinkedList Implement sorting algorithms such as Insertion Sort, Merge Sort, and Quick Sort and understand the performance trade-offs between them See how to implement various binary trees, B-Tree, and Splay Trees Perform advanced searching methods using Red-Black trees, AVL trees, and Trie trees, and take a look at several substring search algorithms Get to know about the data structures used in graphs and how to implement graphs such as depth-first search, breadth-first search, directed graphs, spanning tree, and shortest path Explore algorithm efficiency and see how to measure it
数据结构与算法分析:C语言描述清晰版》是由美国著名计算机科学家Mark Allen Weiss所著,是一本介绍数据结构和算法的经典教材之一。该书内容丰富、深入浅出,既有基础知识的讲解,也有高级算法的探讨,适合计算机科学及其他相关专业的学生、计算机编程爱好者、程序员等人群。 本书主要内容包括线性结构、递归、树、排序和搜索算法、散列表、图等多个章节。其中,线性结构是数据结构的基础,包括线性表、栈、队列等数据结构的实现和操作。递归是一种特殊的函数调用方式,在算法设计中应用广泛,本书详细讲解了递归的原理和应用。树是一种重要的非线性数据结构,本书介绍了二叉树、堆、AVL树等多种树形结构的实现和应用。排序和搜索算法是解决各种实际问题的重要工具,本书详细讲解了冒泡排序、插入排序、归并排序、快速排序等多种排序算法及二分查找、哈希表查找等多种搜索算法。散列表是一种实现高效查找的数据结构,本书深入浅出地讲解了散列表的实现原理和应用。图是一种复杂的数据结构,在算法设计中具有很高的应用价值,本书介绍了图的表示方法、遍历方法和最短路径算法等多个方面的内容。 总的来说,《数据结构与算法分析:C语言描述清晰版》是一本综合性的计算机科学教材,既适合初学者入门学习,也适合中高级程序员深入研究。本书内容翔实,全面而深入,不仅介绍了数据结构和算法的基本知识,还讲解了实践中的应用技巧和注意事项,对于从事计算机科学相关领域的人员来说,具有很高的实用价值和参考意义。如果你想在数据结构和算法方面有更深入的了解,那么这本书绝对是你不可错过的参考资料。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值