In order to gain a better understanding of queues and stacks, I read over the Python documentation for Queues: it recommended using deque from the collections module in order to reduce the run time for enqueue and dequeue, using queue.popleft() and queue.append(). Using the module testqueue.py, the time for 10000 through 100000 items remained nearly constant: around 0.05 seconds, whilst for the lab, if I remember correctly, the time increased linearly with the increase in items. I will try to find out more about the implementation of the queue.popleft() in order to discover why this is more efficient than manually shifting the index of each element every time front() or dequeue() is used.
Another benefit of using the Python documentation is that it seems to be following the progression of our course, so reading along from 5. Data Structures helps to reinforce ideas introduced in the lectures.
I also looked to the Python shell in order to help me figure out how Exceptions work: the help function for Exception mentioned "Exception" as well as "BaseException," so I am trying to understand the difference between them- especially since Python documentation recommended only making subclasses inheriting from Exception, rather than BaseException.
Note: This is extremely embarrassing, but I was looking over the Abstract Data Types section for our lecture reading, and, quite unequivocally, it mentions "An abstract data type....does not specify the implementation of [its] methods..."
Friday, January 24, 2014
Sunday, January 19, 2014
Week 2- OOP Continued
January 14, 2014
The first lab section for the semester was a bit terrifying: the readings 'Code Like a Pythonista' contained strange new content, and lab comrades seemed to be much more adept at generating code for the given problems. At home, I got to work: I read over the given 'Code like a Pythonista' sections again, practiced the new material in IDLE, and redid the lab again at home.
I also looked over http://ddc-csc148slog.blogspot.ca/, a blog written by another student in 148, and it provided a good summary of the new Abstract Data Types we encountered this week.
The first lab section for the semester was a bit terrifying: the readings 'Code Like a Pythonista' contained strange new content, and lab comrades seemed to be much more adept at generating code for the given problems. At home, I got to work: I read over the given 'Code like a Pythonista' sections again, practiced the new material in IDLE, and redid the lab again at home.
I also looked over http://ddc-csc148slog.blogspot.ca/, a blog written by another student in 148, and it provided a good summary of the new Abstract Data Types we encountered this week.
Subscribe to:
Comments (Atom)