Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elementary Statistics

Authors: Robert R. Johnson, Patricia J. Kuby

11th Edition

978-053873350, 9781133169321, 538733500, 1133169325, 978-0538733502

More Books

Students also viewed these Programming questions

Question

14. How do jalapeos produce a hot sensation?

Answered: 1 week ago