ARTS - Week 1

ARTS挑戰html

Algorithm : 編程訓練和學習 —— 每週至少作一個LeetCode算法題。node

Review : 學習英文 —— 閱讀並點評至少一篇英文技術文章。python

Tip : 總結和概括知識點 —— 學習至少一個技術技巧。web

Share : 創建影響力,可以輸出價值觀 —— 分享一篇有觀點和思考的技術文章。算法

文中涉及語言均爲Python。express

Algorithm

題目

24. 兩兩交換鏈表中的節點(中等)編程

給定一個鏈表,兩兩交換其中相鄰的節點,並返回交換後的鏈表。api

不能只是單純的改變節點內部的值,而是須要實際的進行節點交換。bash

示例:服務器

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


若有任何疑問或錯誤,歡迎指出。

相關文章
相關標籤/搜索