開始使用免費開始

實作 linked list

在影片中,你學到如何透過實作 Node() 類別與 LinkedList() 類別來建立單向 linked list。

在這個練習中,你會練習實作這兩個類別。第一步先實作 Node() 類別,第二步再實作 LinkedList() 類別。準備好了嗎?

本練習屬於課程

Data Structures and Algorithms in Python

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

class Node:
  def __init__(self, data):
    # Store the value for the node
    self.value = ____
編輯並執行程式碼