class node:
def __init__(self, theData, nextNodeNumber):
self.data = theData
self.nextNode = nextNodeNumber
startp = 0
emptyp = 5
llist = [node(1,1),node(5,4),node(6,7),node(7,-1),node(2,2),node(0,6),node(0,8),node(56,3),node(0,9),node(0,-1)]
def Outputnodes(Array, pos):
while Array[pos].nextNode != -1:
print(Array[pos].data)
pos = Array[pos].nextNode
print(Array[pos].data)
def AddNode(Array, pos, loca):
data = int(input("Enter the date to be added"))
temp = loca
if loca == -1:
state = False
else:
Array[loca].data = data
while Array[pos].nextNode != -1:
pos = Array[pos].nextNode
Array[pos].nextNode = loca
loca = Array[loca].nextNode
Array[temp].nextNode = -1
state = True
return state, Array, loca
for index in range(5):
x, llist, emptyp = AddNode(llist, startp, emptyp)
if x == False:
print("Array is full")
else:
print("Value added successfully")
Outputnodes(llist, startp)
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}