This week is the last week of school, as much as I feel relieved, the pressure of final exam is quickly approaching.
In week 11, we learned about Big-Oh. This concept was difficult for me because while my peer studied this in CSC165, I took CSC165 in UofT Scarbough and we never discussed this topic. From my understanding of the lecture and the additional readings I did, I feel that Big-Oh is basically the upper bound of the running time of a function. For instance Big-Oh(x^2) means an upper bound, and any function that runs faster than quadratic is not in Big-Oh(x^2). Same logic follows for Big-Oh(x^3) and higher.
I believe the fundamental Idea of Big-Oh is to test how fast a program runs, and whether the running speed can be optimized. A quadratic function that solves a problem is obviously better than a cubic function. The use of Big-Oh to measure running time can therefore determine if a function is well-written and efficient or not.
In this lecture we also briefly touched upon ways to count running time of different functions, and see if they are in Big-Oh. We however, did not discuss this in detail. The professor gave a few examples to count, but I did not quite get that. I remember one way I learned is that the running time of a for-loop can be determined by multiplying the Big-Oh of the inner loop( linear, quadratic or cubic) by the Big-Oh of the outer loop.
I think this new concept will not be too challenging, because many of my friends have studied it and I can go to them for help. Furthermore, I also think recursions and classes are more complicated and calculation-oriented than this. However, I recognize that this concept is extremely useful, as the ultimate goal of a programmer is to write code that are both correct and efficient.
Sunday, 5 April 2015
Sunday, 29 March 2015
week 11
This week we focus on sorting and the efficiency of coding. We touch on 4 kinds of sorting, which are quick sort, bubble sort, selection sort and insertion sort. All of them are used to put elements of a list in a certain order. Recursion can be used to help complete that process.
To evaluate the efficiency of coding methods, we learnt big O. Big O is an estimate of the worst case performance of a function assuming the algorithm will perform the maximum number of iterations. Algorithm that need to a longer running time will be considered less efficient.
For quick sort, big-O is nlgn, for the rest 3 sorting algorithm , big-O is n^2.
This week we start to read and think about assignment 3, and decided to choose option A. But still have no idea about it. Hope we can get some idea next week.
week 10
In this week, our lecture mainly focus on 4 parts -- minimax strategy for our assignment 2, testing, making assertions, and function call stack.
For minimax strategy, our base case is to check after applying the move, whether the game is over or not. If it is over, we can use outcome method to get its opponent's score, otherwise, repeat applying move until we can get a final score. compared with methods provided by professor, ours uses the same ideas with a different code structure. Actually, this part has the most difficulty, it is the first time for us to use recursive method in a relative bigger task. With a correct thinking, hope we use recursion correctly.
For testing, in our lecture we also take assignment 2 for example. We learnt how to analyze test parameters, choosing test cases, and use methods setUp and tearDown to reduce repeated code when we test the chosen cases.
We also discuss making the assumptions into assertions. if condition is not satisfied, raise
AssertionError.
At the end of the class, we discussed function call stack. From the knowledge of lecture, a call stack is a stack data structure that stores information about the active subroutines of a computer program, which is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing. An active subroutine is one that has been called but is yet to complete execution after which control should be handed back to the point of call.
Assignment 3 has been posted yet, maybe we will have a busy period of time to complete it.
For minimax strategy, our base case is to check after applying the move, whether the game is over or not. If it is over, we can use outcome method to get its opponent's score, otherwise, repeat applying move until we can get a final score. compared with methods provided by professor, ours uses the same ideas with a different code structure. Actually, this part has the most difficulty, it is the first time for us to use recursive method in a relative bigger task. With a correct thinking, hope we use recursion correctly.
For testing, in our lecture we also take assignment 2 for example. We learnt how to analyze test parameters, choosing test cases, and use methods setUp and tearDown to reduce repeated code when we test the chosen cases.
We also discuss making the assumptions into assertions. if condition is not satisfied, raise
AssertionError.
At the end of the class, we discussed function call stack. From the knowledge of lecture, a call stack is a stack data structure that stores information about the active subroutines of a computer program, which is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing. An active subroutine is one that has been called but is yet to complete execution after which control should be handed back to the point of call.
Assignment 3 has been posted yet, maybe we will have a busy period of time to complete it.
Wednesday, 18 March 2015
week 9
We done the test 2 this week, I spent about 4 days to prepare it, mainly focus on labs. I found recursion structure is really hard for me to built. Many times my code works, but I don't know why it can work! It makes me really confusion, maybe I do not actually understand how to build the logic.
This test is not very hard, but I made some silly mistakes. Hope I can do better in later tasks.
This test is not very hard, but I made some silly mistakes. Hope I can do better in later tasks.
Sunday, 15 March 2015
week 8
In this week we tough upon a new concept, linked list. In my view, linked lists are fundamental data structures that every programmer should know, it consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a data and a link to the next node in the sequence. for LLNode, if we know the value of a node, we can get the value of the next node. For the class of linked list, we can get the size of the linked list, front node and the back node. Combine LLNode with linked list, we can create many methods to process linked list such as append, prepend, insert before, delete back, delete after, change the value of the node in a specific index position etc. May be in the following class we will learn implementation of recursion in linked list, we will have a deeper understanding of linked list.
We finished the assignment 2 in this week, the most difficult part in this assignment is minimax strategy. Because we are not good at using recursion, our logical thinking need to improve. fortunately, we complete it, hope we can get a good mark.
We finished the assignment 2 in this week, the most difficult part in this assignment is minimax strategy. Because we are not good at using recursion, our logical thinking need to improve. fortunately, we complete it, hope we can get a good mark.
Monday, 2 March 2015
week 7
Revisit OOP
I have heard much discussion about what Objected oriented language is before I approached computer science, but I never truly understood it. Even until know, my understanding of this concept is still quite limited, but I will try my best to demonstrate my insight of this topic. In CSC108, we mainly studied programming with respect to logic. We would write functions which takes an input and produces an output. However, what we learn in CSC148 is much different. Instead of working with functions, we begin to focus solely on working with class. I believe dealing with class marks our first experience dealing with an Object. A class is an object because it has attributes such as type and data structure, as well as many methods to perform operations on it. These attributes define what the object is, and what the object can do. Think the class ball as an example. The ball may have certain attributes such as weight, perimeter and material. These will define the basic attributes of what the ball is. It may also have methods that defines how far the ball will move when certain force is exerted on it. The attributes define what the object is, and thus allow a new object to be created. Note that in many cases a sub-class may be required to implement the main attribute, or in another word, define the object. A sub-class may also inherit the existing methods of the main class, and perform operations to define a new object. For instance, a valid sub-class of the main class ball would be ‘football’ or ‘soccer ball’.
I believe OPP is basically programming by allowing the classes(objects)/modules to interact with one another. The advantage of OPP is that the programs are made up with many different modules. The modules are often very easy to modify in case there is a mistake or need for improvement. This feature also allows the modules to be replaced in times of need without jeopardizing the entire program.
Thursday, 19 February 2015
Week 6
In my opinion, object oriented programming is basically programming based on an object. In another word, we program by defining various objects, make them interact, and produce our desired outcome from their interaction. One classic example of object is ‘class’ that we learned how to build in the past couple weeks. A class has certain attributes, a type, and can interact with other classes. For instance, if we design a class for inventory, we can have a type ‘integer’ to describe the number of inventory, the method ‘reduce inventory’ to take an inventory away, and interact our class inventory with another class, perhaps supermarket, to collectively produce a computer program for inventory check of a super market.
Simply speaking, I believe object-oriented language is basically programming to create an object through defining classes. The classes would compile into a large program, and through the interaction of the classes, a complete program can be made.
Simply speaking, I believe object-oriented language is basically programming to create an object through defining classes. The classes would compile into a large program, and through the interaction of the classes, a complete program can be made.
Thursday, 12 February 2015
WEEK 5
Week 5 is a busy week for me, I completed 3 midterms and an assignment. Now is 5 am, I finally have time to summarize my busy week. This week we continue learning recursion, in my opinion, recursion is the process of repeating items in a self-similar way, its function is very similar with loop. It is a good way to simplify code through using function in function itself. I think if you wanna use it correctly, you need to have a strong ability of logical thinking. Now I can trace the process, but write a function with recursion is still a difficult things for me.
Finally, I wanna complain about the term test 1, 50 mins is not enough for this test, I left the first question blank, it is a sad story....
Finally, I wanna complain about the term test 1, 50 mins is not enough for this test, I left the first question blank, it is a sad story....
Friday, 30 January 2015
Week4
This week is so stressful for me and for the first time I realized how difficult and annoying computer science can be . My partners were not the best helpers in the world and I had to work very hard on the first assignment. THERE WERE SO MANY INCLARITIES!!!!!!!!! The whole assignment was very confusing. Initially I thought 2 class would do the work. Then the prof said we at least needed 5, so I had to redo the thing. After many hours of investments and attempts, I finally did it and it ran perfectly. The examples and test cases were also pain in the ass. I can’t believe its so much work for so little mark!! I honestly think the assignments should be 15% each or 20% instead of 10. This is unfair!
Anyways, now I am preparing for the test whole-heartedly. I will prove myself and all those days of hard work in the test field!
Thursday, 22 January 2015
Why Geek Write
Instead of thinking about why should geeks write, it is perhaps better to take a step back to think about why should anyone write. Writing is doubtlessly the most important means of communication between humans. Programmers, like everyone else, are human beings that need to communicate. The reason to why should geek write is then obvious- to communicate to other geeks and non geeks.
Good writing will lead to good code. It makes sure the code is organized, has proper function and variable names, and is structured to be clear and comprehensive. The good code will make it easy for other programs to test or quote it the code, which will save much time and effort for other programs. In reality, many programmers tend to work together on a single project. If all programmers can write appropriately, it will enhance the efficiency of collaboration, save time and effort, and lead to overall better code. Furthermore, being able to write properly will allow the computer scientists to be more capable of independently conducting scientific research and thesis construction. Writing skills become extremely important in those settings, and allow the programmer to write better research paper which will help advancement in the field of computer science.
Good writing is also important when programmers write to non-geeks. For instance, it becomes important when the computer scientists write to describe its program to potential venture investors or employers. Good writing in those settings can mean a great opportunity for the programmer, and failure in writing skills can lead to failure to catch such opportunity.
Subscribe to:
Posts (Atom)