Saturday, 7 February 2015

Week 5 - Experiences and Summary of Abstract Data Types.

This past week was an interesting week. The lectures ended quite early, and we were introduced to two new Abstract Data Types in Python. We were introduced to Stacks and Queues. The concepts weren't too difficult to grasp during lecture. I learned that a stack is a collection of items, meaning that it has multiple elements. This can be compared to lists and dictionaries, which can also contain multiple elements. We talked about some interesting basic operations that stacks have.
These include:
1. Stack(), which creates a new stack. New stacks are usually stored in a variable, so if I were to create a new stack, I would write: stack = Stack().
2. is_empty(), which checks to see if the stack has any elements. This method has a boolean return type, and returns True if and only if the stack has no elements. When calling this method, I would write: stack.is_empty().
3. push(item), which pushes an item to the top of the stack.
4. pop(), which removes and returns the item at the top of the stack.

Stacks follow the last in first out protocol. This means, that whatever has been pushed last is the first to be removed when we choose to remove an element from the stack.

Queues, however, follow the first in first out protocol. Basic operations of Queue include:
1. Queue, which creates a new queue.
2. enqueue(), which adds an item to the back of the queue
3. dequeue(), which removes an item from the front of the queue.

Queues follow the first in first out protocol. This means that whatever was added to the first in the queue is the first to be removed when we choose to remove an element from the queue.

I did not perform well in the lab as I hoped I would. I showed up to the lab on time and I did the basic exercises in the lab that were assigned. I got a basic understanding of how to write methods in class Stack and class Queue, and I got a basic understanding for their operations. However, I did not do the additional exercises, which required us to trace what some functions implemented in the lab would do with complicated lists (the functions being stack_list and queue_list). Regardless of what the operations of those functions are, while doing the quiz, I realized that to gain a solid understanding of what is required in the course, I should work on the additional lab exercises. This is what I will do from now and on to improve my performance in the lab quizzes and to gain a solid understanding of what is required in the course.

My experiences in the course is similar to that of the blogger with the link: (http://2ne1bigbangexosuperjuniorbts.blogspot.ca/2015/02/week-5-slog.html). Similar to this blogger, I too was excited when I heard that we would be allowed an aid sheet for the test, but while writing the aid sheet, I felt as though what I am writing is already in my brain. I felt as though the best way to prepare for the test is by re doing lab questions for practice, and working on the additional lab exercises. Similar to the blogger, I didn't read the aid sheet during the test because everything was already in my brain. I agree with the blogger when he/she says that the purpose of allowing an aid sheet is to help us review for the test, not to help us cheat on the test by looking at a secondary source.

I am looking forward to a fantastic next week!

No comments:

Post a Comment