Computer Science > QUESTIONS & ANSWERS > Wilfrid Laurier University - CP 164Deque_doublylinked (All)
""" ------------------------------------------------------- Implementation of Deque ADT using doubly-linked list ------------------------------------------------------- Authors: David Brown and Ma ... soomeh Rudafshani IDs: 999999999 and 123456789 Emails: [email protected] and [email protected] Section: CP164OC ------------------------------------------------------- """ # pylint: disable=W0212 # Imports from copy import deepcopy class DNode: def __init__(self, element): """ ------------------------------------------------------- Initializes a Deque node. Use: node = DNode(value, _prev, _next) ------------------------------------------------------- Parameters: _data - data value for node (?) _prev - pointer to another Deque node (DNode) _next - pointer to another Deque node (DNode) Returns: a new DNode object (DNode) ------------------------------------------------------- """ self._data = deepcopy(element) self._prev = None self._next = None class Deque: def __init__(self): """ ------------------------------------------------------- Initializes an empty Deque. Use: deque = Deque() ------------------------------------------------------- Returns: a new Deque object (Deque) ------------------------------------------------------- """ self._front = None self._rear = None self._count = 0 def isEmpty(self): """ ------------------------------------------------------- Determines if the Deque is empty. Use: b = deque.isEmpty() ------------------------------------------------------- Returns: True if the deque is empty, False otherwise. ------------------------------------------------------- """ if self._count == 0: b = True else: b = False return b #your code goes here def size(self): """ ------------------------------------------------------- Determines the size of Deque. Use: b = deque.size() ------------------------------------------------------- Returns: the number of data elements in the deque ------------------------------------------------------- """ return self._count [Show More]
Last updated: 3 years ago
Preview 1 out of 5 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 21, 2021
Number of pages
5
Written in
All
This document has been written for:
Uploaded
Apr 21, 2021
Downloads
0
Views
109
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·