ARTS - 第一期

ARTS挑战

Algorithm : 编程训练和学习 —— 每周至少做一个LeetCode算法题。

Review : 学习英文 —— 阅读并点评至少一篇英文技术文章。

Tip : 总结和归纳知识点 —— 学习至少一个技术技巧。

Share : 建立影响力,能够输出价值观 —— 分享一篇有观点和思考的技术文章。

文中涉及语言均为Python。

Algorithm

题目

24. 两两交换链表中的节点(中等)

给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。

不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。

示例:

Input: 1->2->3->4
Output: 2->1->4->3.

思路

此题涉及3个指针的转换,可画图说明。

p1-初始赋值

# 初始赋值
p.next = head

p2-循环1

# 第一遍循环
q = p.next
r = q.next

q.next = r.next
r.next = q
p.next = r

p3-循环1

# 第一遍循环结束
p = q

p4-循环2

# 第二遍循环,同上
q = p.next
r = q.next

q.next = r.next
r.next = q
p.next = r

p5-循环2

# 第二遍循环结束,循环停止
p = q

代码

def swapPairs(self, head: ListNode) -> ListNode:
    p, p.next = self, head
    while p.next and p.next.next:
        q = p.next
        r = q.next
        p.next, r.next, q.next = r, q, r.next
        p = q
    return self.next

时间复杂度:O(n),空间复杂度:O(1)。

Review

What is an API? In English, please.

API指应用程序编程接口。互联网上的每一个界面都被存储在一个远程服务器里。每当在互联网上访问一个页面的时候,都在与某个远程服务器的API发生交互。API是服务器的一部分,负责接收请求并发送响应。

API是一种为客户提供服务的方式。当一家公司为客户提供API的时候,这仅仅意味着它们建立了一组专用的URL通道,用来返回纯数据响应,响应内容不会包含图形用户界面(例如网站)中的显示开销。

API中的“A”指应用Application。任何能从自身环境中分离出来的软件都可以成为API中的“A”,且很可能它本身也是某种API。
若在代码中使用的是第三方库,一旦该库与代码整合在一起,这个库也就成为了整体应用的一部分。作为软件中特殊的一部分,库很有可能也拥有一个API,使其与剩余代码进行交互。

Tips

异或运算符: ^ (for Python)

异或:Exclusive OR (xor)

异或也叫半加运算,其运算法则相当于不带进位的二进制加法:二进制下用1表示真,0表示假,则异或的运算法则为:0⊕0=0,1⊕0=1,0⊕1=1,1⊕1=0(同为0,异为1),这些法则与加法是相同的,只是不带进位,所以异或常被认作不进位加法。

异或运算应用场景:

  1. 快速比较两个值
  2. 用于将变量置零:a ^ a
  3. 使用异或来使某些特定的位翻转,因为不管是0或者是1与1做异或将得到原值的相反值
  4. 互换二进制数的奇偶位
  5. 不使用其他空间,交换两个值

其他位运算符号 (Bitwise Operator):

相关链接:

Mapping Operators to Functions - Python.org

6.9. Binary bitwise operations - Python.org

Python Bitwise Operators Example

异或的应用

Share

Six Recommendations for Aspiring Data Scientists

作者阐述成为数据科学家需要的6个关键性经验:

1. Get hands-on with cloud computing 体验云计算

云计算平台可以提供工具使数据工作流与可预测模型扩展到海量数据规模。日常会用到的平台如Amazon Web Services (AWS)、Google Cloud Platform (GCP),这些平台会提供部分免费服务,即使免费服务项目中无法处理海量数据集,但可满足基本体验。

One of my recommendation is to try out different features on these platforms, and see if you can use some of the tools to train and deploy models.

建议:尝试使用这些平台的不同功能,并用其中的工具训练和部署模型。

2. Create a new data set 创建一个新的数据集

实际项目中常常需要将原始数据集转化为用于分析或模型的数据集,数据整理 (data munging) 通常需要收集额外的数据集以便于数据转换。

My second recommendation is to actually go a step further and build a data set. This can include scraping a website, sampling data from an endpoint (e.g. steamspy), or aggregating different data sources into a new data set.

建议:自己创建一个新数据集(通过爬虫)。

3. Glue things together 将事务整合

One of the skills that I like to see data scientists demonstrate is the ability to make different components or systems work together in order to accomplish a task.

数据科学家需要将不同组件或系统的工作汇总,以整合为一个完整的项目。

My recommendation here is to try to get different systems or components to integrate within a data science workflow.

建议:尝试接触不同系统或组件的事务,集成到数据科学工作流。

4. Stand up a service 提供服务

As a data scientist, you’ll often need to stand up services that other teams can use within your company. Being able to prototype services means that other teams will be able to use your data products more quickly.

My recommendation is to get hands on experience with tools such a Flask or Gunicorn, in order to setup web endpoints, and Dash in order to create interactive web applications in Python. It’s also useful practice to try setting up one of these services in a Docker instance.

建议:使用Flask / Gunicorn工具设置网络终端,Dash工具创建网络交互应用,也可在Docker实例中创建某项服务。

5. Create a stunning visualization 创建令人惊叹的可视化

可视化可谓分享分析报告或模型之前的第一印象,优秀的可视化可以赢得更好的关注。

My recommendation here is to learn a variety of visualization tools in order to create compelling visualizations that stand out.

建议:学习多样的可视化工具以提高创建可视化的能力。

6. Write a white paper 写一份白皮书

One of the data science skills that I’ve been advocating for recently is the ability to explain projects in the form of a white paper that provides an executive summary, discusses how the work can be used, provides details about the methodology, and results. The goal is to make your research digestible by a wide audience and for it to be self explanatory, so that other data scientists can build upon it.

Blogging and other forms of writing are great ways of getting experience in improving your written communication. My recommendation here is to try writing data science articles for broad audiences, in order to get experience conveying ideas at different levels of detail.

建议:多写博客或其他形式的写作可以提高写作能力,尝试写一些数据科学文章。


作者附加了一些链接,总结其一:可视化工具汇总,以便日后学习。

10 Years of Data Science Visualizations

2007: MATLAB

2008: Java

2009: Excel

2010: Weka

2011: Java

2012: Protoviz

2013 - 2014: Tableau

2015: R(Shiny) + dygraphs package

2016: R + CausalImpact package

2017: R + ggplot2 package


如有任何疑问或错误,欢迎指出。

猜你喜欢

转载自blog.csdn.net/Treasure99/article/details/88913032