Answered step by step
Verified Expert Solution
Question
1 Approved Answer
all coding is on python def 4. Create a class Deque and implement the functions of double ended queue. All functions should run in O(1).
all coding is on python
def 4. Create a class Deque and implement the functions of double ended queue. All functions should run in O(1). a. Write a function InsertFront that inserts an element at the front of the Deque. b. Write a function GetFront that returns the front item from the Deque. c. Write a function DeleteFront that removes an item from the front of Deque. class Deque : init__(self): 17 your code goes here def InsertFront (self, value): // your code goes here def GetFront (self): // your code goes here def DeleteFront (self): // your code goes here 5. Create a class DList and add the following functions. All functions should run in O(n). a. Write a function Insert that takes an argument x. Where x is an integer value. The function should insert the value x in a sorted doubly linked list. You have to make sure that the list should remain sorted after inserting the value of x. b. Write a function Is Sorted that checks if the doubly Linked List is sorted or not. The function should return True if the List is sorted otherwise it should return false. c. Write a function DeleteDuplicates that deletes duplicate values from the linked list. The function should return a sorted list after deleting the duplicate values. class DNode: def _init__(self, value): self.value = value self.next = None self.previous = None class DList: def _init__(self): self.head = None self.tail = None def Insert (self,x,)): // your code goes here def IsSorted (self): 1/ your code goes here def DeleteDuplicates (self): // your code goes hereStep by Step Solution
There are 3 Steps involved in it
Step: 1
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