repl.it
@simontiger/

todo_queue

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Node:
  def __init__(self, data, next_):
    assert isinstance(next_, Node) or next_ == None
    self.data = data
    self.next = next_

class LinkedList:
  def __init__(self):
    self.head = None
  
  def unshift(self, data):
    self.insert(data, 0)

  def insert(self, data, idx):
    if not self.head: