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

1 Expert Approved Answer
Step: 1 Unlock

Answer class ListNode def initself data selfdata data selfnext None class LinkedList def initself se... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!