Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Handouts: Matrices, Alternate List ADT | COSC 350, Study notes of Data Structures and Algorithms

Material Type: Notes; Professor: Sloan; Class: Data Structures; Subject: Computer Science; University: Wofford College; Term: Fall 2008;

Typology: Study notes

Pre 2010

Uploaded on 08/17/2009

koofers-user-p3z
koofers-user-p3z 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS350: Data Structures Class Notes
Week 6, Class 17: Wednesday, October 8, 2008
Announcements: ACM tonight at 6:30 in Olin student lounge
Handouts: Matrices, Alternate List ADT
We discussed overloading in Python. We looked at examples of __len__, __rmult__
(vs __mult__), and __getitem__ and __setitem__. This was in the context of an
array class. (See code example linked from class page.)
We briefly discussed destruction of data and garbage collection. Garbage collection is
needed because cutting a link may result in memory that is no longer used. This is too
complicated to investigate each time a link is cut, so garbage collection is used in Python.
(In other languages you may need to explicitly return to the OS memory that isn’t used.)
Two approaches are stop and copy and mark and sweep. Stop and copy separates
memory into two equal blocks. When the system runs out of memory, the system stops
and copies reachable data into the other block. Any remaining memory in the block is
free. The next time memory is exhausted, the copy goes in the other direction. With
mark and sweep, a vector of bits is used to mark used memory. When memory is
exhausted, the system will sweep thorough memory marking used memory. An memory
that isn’t visited, isn’t marked so it can be considered as free.
We compared different approaches to linked lists talking about what might be included.
In particular, we talked about operations that were missing from the text ADT such as
displaying items or the full list. We also talked about the use of a current pointer and a
tail pointer. We looked at an ADT from another book that had a current pointer.
We also talked about inheritance and the ordered list implementation.
Homework for Friday: Matrix Project.
Homework for Monday: Extend Linked List with classes for Queues and Deques. Use
inheritance. This counts as two assignments.

Partial preview of the text

Download Handouts: Matrices, Alternate List ADT | COSC 350 and more Study notes Data Structures and Algorithms in PDF only on Docsity!

CS350: Data Structures Class Notes

Week 6, Class 17: Wednesday, October 8, 2008 Announcements: ACM tonight at 6:30 in Olin student lounge Handouts: Matrices, Alternate List ADT We discussed overloading in Python. We looked at examples of len, rmult (vs mult), and getitem and setitem. This was in the context of an array class. (See code example linked from class page.) We briefly discussed destruction of data and garbage collection. Garbage collection is needed because cutting a link may result in memory that is no longer used. This is too complicated to investigate each time a link is cut, so garbage collection is used in Python. (In other languages you may need to explicitly return to the OS memory that isn’t used.) Two approaches are stop and copy and mark and sweep. Stop and copy separates memory into two equal blocks. When the system runs out of memory, the system stops and copies reachable data into the other block. Any remaining memory in the block is free. The next time memory is exhausted, the copy goes in the other direction. With mark and sweep, a vector of bits is used to mark used memory. When memory is exhausted, the system will sweep thorough memory marking used memory. An memory that isn’t visited, isn’t marked so it can be considered as free. We compared different approaches to linked lists talking about what might be included. In particular, we talked about operations that were missing from the text ADT such as displaying items or the full list. We also talked about the use of a current pointer and a tail pointer. We looked at an ADT from another book that had a current pointer. We also talked about inheritance and the ordered list implementation. Homework for Friday: Matrix Project. Homework for Monday: Extend Linked List with classes for Queues and Deques. Use inheritance. This counts as two assignments.