Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a [slice method] for an unordered list. It takes two parameters, start and stop , and return a copy of the list starting at

Implement a [slice method] for an unordered list. It takes two parameters, start and stop, and return a copy of the list starting at the start position and going up to but not including the stop position. The original list should not be altered in any way by the slice method.

Note: The way I did it is not right!!!!!!! I am seeking a correct answer. Thank you!

class unordered class:

class Node: def __init__(self,initdata): self.data = initdata self.next = None def getData(self): return self.data def getNext(self): return self.next def setData(self,newdata): self.data = newdata def setNext(self,newnext): self.next = newnext class unorderedlist: def __init__(self): self.head = None def isEmpty(self): return self.head == None def add(self,item): temp = Node(item) temp.setNext(self.head) self.head = temp def size(self): current = self.head count = 0 while current != None: count = count + 1 current = current.getNext() return count

.........

.........

.........

etc...

def slice(self,start,stop):

image text in transcribed

F# 3. (10 points) Programming Exercise 19 from Chapter 4 of your textbook. The "copy" being # created here is another instance of the Unordered List class with contents as described in # Programming Exercise 19. The original list should not be altered in any way by the slice A# method. # def slice(self, start, stop): sample = [] if self.head == None: print('Empty Stack') else: current = self.head while current != None: sample.append(current.getData()) current = current.getNext() return sample copy = slice(start, stop) return print(sample[copy])| E A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago