NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

class Node:
def __init__(self,data):
self.data=data
self.next=None

class Linked_list:
def __init__(self):
self.head=None
self.p=None
def insert_start(self,data):
new=Node(data)
new.next=self.head
self.head=new
def insert_end(self,data):
new=Node(data)
if self.head == None:
self.head=new
self.p=new
else:
self.p.next=new
self.p=self.p.next
def insert_aft(self,data,e):
new=Node(data)
self.p=self.head
while self.p.data!=e:
self.p=self.p.next
new.next=self.p.next
self.p.next=new
def insert_bef(self,data,e):
new=Node(data)
self.p=self.head
while self.p.next.data!=e:
self.p=self.p.next
new.next=self.p.next
self.p.next=new
def traverse(self):
self.p=self.head
while self.p!=None:
print(f"n{self.p.data}")
self.p=self.p.next
def nodecnt(self):
self.p=self.head
self.cnt=0
while self.p!=None:
self.cnt+=1
self.p=self.p.next
print(f"nNo. of nodes:{self.cnt}")
def search(self,e):
self.p=self.head
self.c=1
while self.p.data!=e:
self.p=self.p.next
self.c+=1

print(f"Found at:{self.c}")


l=Linked_list()
while True:
a=input("Enter 1 for appendn2 for insert at startn3 for traversen4 for countn5 for insert after elementn6 for insert before elementn7 for exitn")
if a=='1':
n=int(input("Enter data:n"))
l.insert_end(n)
elif a=='2':
n=int(input("Enter data:n"))
l.insert_start(n)
elif a=='3':
l.traverse()
elif a=='4':
l.nodecnt()
elif a=='5':
e=int(input("Enter the element:n"))
n=int(input("Enter data:n"))
l.insert_aft(n,e)
elif a=='6':
e=int(input("Enter the element:n"))
n=int(input("Enter data:n"))
l.insert_bef(n,e)
elif a=='7':
break
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.