• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

CSC148 Test Study Terms with Complete solutions

Document preview thumbnail
Preview 2 out of 8 pages

CSC148 Test Study Terms with Complete solutions

Content preview

CSC148 Test Study Terms with Complete solutions
(

time of inserting and deleting in front of a list is proportional to its length



class _Node - ANSWER represents a single element of a list, and stores its item and the
next item after


class _node design - ANSWER item: Any
next: Optional[_Node]


def __init__(self, item: Any) -> None:
self.item = item
self.next = None


Linked List Class - ANSWER a list implementation of the List ADT



implementation - ANSWER _first: Optional[_Node]

def __init__(self) -> None: self._first = None




creating a linked list - ANSWER >>> linky = LinkedList()

, >>>node1 = _Node(10)
>>>node2 = _Node(20)
>>>node3 = _Node(30)
>>>node1.next = node2
>>>node2.next = node3
>>>node1.next is node2
>>>link._first = node1
>>>linky._first.item
10
>>>linky._first.next.item
20
>>>linky._first.next.next.item
30


linked list memory diagram - ANSWER


iterate through the linked list - ANSWER class LinkedList:
def iterate(self) -> None
curr = my_linked_list._first
while curr is not None:
...curr.item...
curr = curr.next


are linked lists stored in consecutive locations in memory? - ANSWER no


array_based list - ANSWER store references to elements in contiguous blocks

Document information

Uploaded on
September 7, 2024
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
CA$19.51

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
KenAli
2.6
(18)
Sold
125
Followers
5
Items
26795
Last sold
5 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions