Friday, April 4, 2014

Week 12: Final Entry

I really enjoyed CSC 148.  This course helped me gain confidence in my ability to code and solve problems.  The labs were the most helpful in this respect.  Labs provided an opportunity to learn the material in a hands-on way, and get help and feedback from a TA and other students.


I would highly recommend taking this course because no matter your field of study, a background in computer science will be useful.  This course can also be fun.  You are constantly trying to solve different problems, and it is a great feeling of accomplishment when you do!

Sunday, March 30, 2014

Week 11: Sorting and Efficiency

Efficiency is related to the running time of an algorithm and thus is a way of measuring the algorithm’s performance.  When comparing two algorithms that accomplish the same task, you want to choose the more efficient one (the one with the fastest running time).  Running time is normally related to the size of the problem, n. For example, n could be the number of elements in a list. 

An algorithm’s complexity is represented using big-oh notation and the size of the problem.  Big-oh is an upper bound on the algorithm’s running time function (for large input values).  For example, constant running time is represented by O(1).  Linear running time is represented by O(n).  Big-oh notation only uses the largest power of n and ignores lower powers and constants.  For example, if f(n) =   4n^2 + 2 and g(n) = 26n^2 + 12n + 9999 are running time functions, both are O(n^2).

Sorting is the process of ordering a collection of elements in some way.  For example, ordering the list [8, 4, 63, 99, 7] to [4, 7, 8, 63, 99].  There are many different sorting algorithms, but they do not all have the same efficiency.  Their efficiency depends on n, the length of the list, and the arrangement of the elements.

Efficiency of some sorting algorithms (links are to animations of the algorithms):                                                                                                                                                                                                  
Selection Sort:
O(n^2) in all cases
Insertion Sort:
worst (and average) case O(n^2)
best case O(n)   # already sorted
Bubble Sort:
worst (and average) case O(n^2) 
best case O(n)   # already sorted
Merge Sort:
O(nlog(n)) in all cases
Quick Sort:
worst case O(n^2)   # already sorted
best (and average) case O(nlog(n))
Tim Sort:
worst (and average) case O(nlog(n))
best case O(n)

I like the idea of big-oh notation.  I think it is a very useful way of determining which algorithms are faster independent of factors like hardware or other external effects.  I think it also helps with algorithm design.  When solving a problem, you need to think carefully about how you approach the problem because there is a “best solution”, the most efficient one.  For example, there are many different sorting algorithms, and each is better than another in certain circumstances (length of the list, if it is already sorted, if it is reverse sorted, etc.).  Tim sort uses this idea.  Tim sort is a hybrid sort (uses merge sort and insertion sort) and it searches for already sorted sub lists.  So, it is one of the best sorting algorithms (at least compared to the ones I have been presented with so far). 


Note: All animations and pictures are from Wikipedia.  I did not create them.

Saturday, March 22, 2014

Week 10: Tests

This week I had a lot going on, and I am so glad it is finished!  My midterms went well, and all my assignments were completed.  Now I am studying for the CSC148 midterm on Wednesday.  I feel confident, but I know I still have a lot to review!

I really struggled with this week’s lab, not because of the content, but my partner and I couldn’t agree on how to approach the problem.  It showed me the importance of communication for team projects!  If you can’t communicate with your partner at least enough to agree on how to approach the problem, you will never get anything done!


Just before I started to write this post, I looked at the SLOG rubric.  I know I am supposed to be commenting and talking about other peoples SLOGs, but as I went through some of the SLOGs, I found a lot are not up to date, or hard to relate to.  I also found that a lot of my problems are not the same as the others.  Is anyone else having this issue?  If so, we should compare thoughts!

Sunday, March 16, 2014

Week 9: Lots of Work

This week was a difficult week for me and next week is too.  This week I had a midterm, exercise 3, and two other assignments.  Next week, I have two midterms and A2 part II.  Luckily, I was able to finish exercise 3 fairly quickly and was able to start A2.  I have written each function, but I still need to do some editing and make sure the functions work the way I think they are supposed to.  I found some of the instructions a little ambiguous after seeing some of the comments and clarifications on Piazza.  Hopefully I will be able to finish the assignment soon!

I really enjoyed lab this week.  All the concepts I was unsure about last week, and some of my concerns from the beginning of this week were clarified.  Thank goodness!  This was also the first time I completely finished a lab with plenty of time to spare (improvement!!!).


Can you believe there are only three more weeks in the semester?  It’s hard to believe exams and summer vacation are just around the corner especially since it’s been SO cold outside!!!