
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Professor: Sloan; Class: Data Structures; Subject: Computer Science; University: Wofford College; Term: Fall 2008;
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!
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.