Sunday, March 9, 2014

Week 8: Linked Lists

For this week, I'll be writing about Linked Lists and part one of the second assignment.

During lectures this week, we learned about Linked Lists, which are similar to Lists and Trees. A Linked List can be thought of as a Tree with an arity of one, which means each node can only have a child node. Also a Linked List contains a value and a reference to another Linked List.

For the lab exercise, my partner and I got to experiment and write code for creating a Linked List class. We got write several methods, such as setting, deleting and inserting an item into the list. We found it difficult however, overall this lab combined with the previous concepts of recursion were really useful and helped me to understand how Linked Lists work.

Also during the week, part one of the second assignment was due. My partners and I worked on it and found that the code which was used for the Regex classes was very similar in structure to code used for the Tree class - that is a Regex contains a value/symbol and has children nodes which can be other Regexes. We also incorporated class hierarchy and used inherited methods in order to reduce duplicate code.

No comments:

Post a Comment