Question
Find and complete the codes for the delete and searchfunctions Language: C++ ''' Welcome to GDB Online. GDB online is an online compiler and debugger
Find and complete the codes for the delete and searchfunctions
Language: C++
'''
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++,Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly,HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
'''
print ('Hello World')
# how to declare a linked list in Python
# assume each node to contain a string data
# declare a Python class for a node
class ListNode:
def _init_(self, data):
self.data = data
self.next = None
class LinkedList:
def _init_(self):
self.head = None
def append(self, data):
if self.head == None:
self.head =ListNode(data)
return
tracker = self.head
while tracker.next != None:
tracker =tracker.next
tracker.next = ListNode(data)
def print(self):
tracker = self.head
while tracker != None:
print("Data: ",tracker.data)
tracker = tracker.next
def delete(self, data):
pass
def search(self, data):
pass
def hashfunc(string):
sumof = 0
for a in string:
sumof += ord(a)
intvalue = sumof % len(string)
return intvalue
mylist = LinkedList()
mylist.append(10)
mylist.append(20)
mylist.print()
Step by Step Solution
3.36 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Answer class ListNode def initself data selfdata data selfnext None class LinkedList def initself se...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started