Showing posts with label Coursera. Show all posts
Showing posts with label Coursera. Show all posts

Sunday, May 15, 2016

End of Algorithms 2

After falling a bit behind schedule, I am almost finished with Algorithms II from Coursera. I have finished all of the prgramming assignments and all of the lectures. All that remain is the final round of exercises.

Like many worthwhile pursuits, I am glad that I went through the classes (both Algorithms I and II), and also happy that it is over.

There were a lot of things I think I gained from the experience. It gave me a good survey of lots of data structures and algorithms. I wanted to fill-in holes in my knowledge of algorithms, and I think that these courses have done just that. For all of the more advanced subjects, I need to take deeper dives, but I am happy that I have a good breadth of knowledge at least.

Additionally, since Algorithms is taught with Java examples, I got to work with a foreign language and its specific coding style and tool-set. While frustrating at times, it's fun to try new things.

And opposite the 'new', the lecturer shared many interesting historical anecdotes throughout the course. I'm not really big on history, but I think these little tidbits made the material a bit more colorful, which also makes it easier to recall things.

A bit of advice

Now that I am about to finish my second massive online course, I wanted to offer you (and future me) some advice about taking online courses:

  • If you start it, finish it. If you say to yourself, "I'll see how it goes", you will undoubtably quit.
  • Do everything. Watch the lectures, do the exercises, do the projects, participate in forums.
  • Set a time(s) in your day/week to do the work. Schedule it like an appointment that you can't miss.
  • Keep up with the new material and the deadlines (even if they're not really enforced).

What I am saying is, be hard on yourself. Don't let yourself have an excuse for not finishing the course. It's so easy to start and quit.

What's next?

I don't have any plans to take any other Coursera courses in the immediate future. I'll check in again later, but I don't see anything that I'd really want to invest time into for now. So, I don't expect to commit anything else this year.

Luckily, I have a nice backlog of study items that I want to work on. More on that later ...

Friday, April 8, 2016

Week 3 of Algorithms Part III. Mincut/Maxflow

I finished the third week's work for Algorithms II from Coursera.

I flew through the lectures and exercises over the weekend. The first set of lectures was on Mincut/Maxflow, and the second set was on Radix sort of strings. It looks like we are wrapping up our work with graphs and restarting work on strings.

I think the mincut/maxcut graph search algorithm is tricky. One example of applying this algorithm is calculating when a baseball team is mathematically eliminated from the playoffs. The programming assignment was based on this baseball problem. It was trivial to complete (we just used an existing API that calculated the maxflow), but it was still hard for me to wrap my head around.

I'll have to review the graph data structure and algorithms more, but it's cool to think that I've learned all the basics. I've always found graph structures to be intimidating. It may be an oversimplification, but here's what I'd say about most graph problems:

- maintain a list of neighbors. 
- do depth first or breadth first search.
- for a given problem, maintain some auxillary data, 
  like previous node or current weight

and that's about it. I should review the material to judge whether that's really an oversimplification or not, but that's what I'm feeling now.

After the mincut/maxflow stuff, the lectures moved to sorting again. Oddly, we studied radix sort, which is rather trivial compared to the more complicated merge/quick/heap sorts. I guess we are transitioning to other string algorithms, so this just a step in that direction.

And now, the course has a break for one week. I will take the week to go over material and the given job interview questions. And, rest.

Sunday, April 3, 2016

Week 2 of Algorithms Part II. MST and Shortest Path

I finished the second week's work for Algorithms II from Coursera.

I had a three day weekend, so I was able to finish the lectures/exercises/programming assignment before the week even started.

We covered Minimum Spanning Trees and Shortest Path algorithms.

For Minimum Spanning Trees, we used Kruskal's algorithm and Prim's Algorithm. I have a hard time remembering what these algorithms refer to. Naming algorithms after a person is nice for that person, but it's a bit pointless. It's like naming a variable in a program after the original coder. It definitely wouldn't pass a code review.

In any case, Prim's algorithm works by doing the following:

Choose a node to start from.
Find the shortest edge that connects it to some other node.
Now, we have a two node component.

Then, repeat the following two steps.
1. From the component, find the shortest edge that connects it to an
   unconnected node.
2. Add that edge and component.

Kruskal's algorithm is a little bit different.

1. Sort the edges from shortest to longest.
2. Choose the shortest edge.
3. Use it if it is making a new connection.
4. Choose the next shortest edge and repeat from step 2.

I think better names for these might be, "NextBestNode" and "NextBestEdge".

Dijkstra's algorithm is an extension of Prim's algorithm where you consider the directions and weights to get the shortest paths.

A key idea in all of these algorithms is to keep building from basic tools. Use things like sorting, priority queues and depth-first or breadth-first iterations, along with some simple arrays for flagging changes and you can come up with some powerful algorithms.

This is demonstrated in the programming assignment. Using a shortest path algorithm with breadth-first searching we're able to do some rather cool image manipulation called seam carving.

This week was fun and cool, but I'll have to go back and review it all so that it really sticks with me moving forward.

Saturday, March 26, 2016

Week 1 of Algorithms Part II. Graphs

I finished Algorithms 1 from Coursera a couple of weeks ago, and this week, I just finished the first weeek's work for Algorithms II from Coursera.

I tried to make the most of my time off between the two classes. I worked on an open source project, did some reading about building web applications and tried to study some other things. During this time off, I realized that I prefer structured classes. They help me to stay focused on the subject of study. With that said, I have to continue to push myself to focus on the material and my deep understanding of it, instead of allowing myself to be satisfied with simply getting the correct answers for the course.

I think some ways to improve my understanding will be to review and participate in the Coursera discussion forums. This gives me a chance to see how others (different from the course instructors) are thinking about the material. In the discussion forum, I can have the chance to approach things as a teacher, which will also help me to understand the material better.

So, onto my thoughts on week 1 of Algorithms 2.

This week, we went over undirected and directed graphs. Using breadth first and depth first searches, we were able to solve some possibly tricky problems like topological sort and finding strong components in directed graphs. The takeaway for me is to get very comfortable with depth and breadth first searches and to have a good mental image of what we get from each. With these two tools you can have a good chance of answering a question. Interestingly, it's a bit difficult to know at first glance how fast you might be able to solve a given problem. It's a lot less intuitive than guessing calculation times of sorting algorithms.

The lectures did an OK job of presenting the material. There were a few demos that you should watch (not just read through). The exercises were rather pain free. They asked you to trace through the steps of things like breadth first and depth first search.

The programming assignment, similar to ones in Algorithm I, asked us to work with existing implementations (this week, a directed graph) instead of writing an implementation on our own. I guess re-writing an implementation on my own can be part of my own self studying. The most time consuming part of this project was understanding the requirements (can there be multiple terms in a synset, is a word unique across synsets, etc ...) After I figured out what the requirements were, it was pretty straightforward to use the provided directed graph class to finish. I'm not sure if it really improved my understanding of Graphs, but at least it didn't take too much time.

Thursday, March 3, 2016

Week 6 of algorithms part 1. Hash table and final exam

The sixth and final week of my coursera algorithms course is done.

This week, we had lectures on hash tables, a set of exercises and a final exam. This was a little different from previous weeks where we would have a little bit more lecture material, two sets of exercises and a programming assignment.

The final exam had a lot of tricky questions, where the major obstacle was just reading the question correctly. I started it a few days ago, and didn't submit until today. Every day, after work, I read over the questions and answers to see if I might have been confused about anything.

I ended up getting an OK score, 9.13 out of 10. I can attempt it a couple of more times, but I don't think there's much point in trying to improve the score. It doesn't really mean anything, and I probably wouldn't learn much by doing it again.

It feels good to be done with this. It's great to finish anything, and this is something I wanted to try and finish years ago.

I signed up for part 2 of this course. After which, I hope to be well versed in all the basic data structures and algorithms that every software developer should know.

The next course starts in 2 weeks, so I'll have a little bit of a break, which is nice. Maybe I'll plan what I want to work on after part 2 of this is done - take another course? study some other way? reallocate time to something else?

Saturday, February 27, 2016

Week 5 of algorithms part 1. Red Black Trees

The fifth week of my coursera algorithms course is done.

This was the most interesting week of study for me. We studied balanced binary search trees. I have read about red black trees trees before, but it never really clicked for me. However, the lecture did a great job explaining red black trees by first presenting the related 2-3 tree. This made understanding the red black tree much easier. I am very happy to know this material now.

The exercises were again helpful in pushing me to really understand red black trees. Can you identify if a node should be red or black? Can you make insertions into such a tree? It was a bit painful to write these trees out on paper and trace through the changes, but it's the best way to really show you know it. The exercises had some true/false questions as always, and I got tricked up on them as always. I feel like they are there just to trip you up a few times and make you repeat the exercises a few times before moving on.

This week's programming assignment was my favorite one so far. We actually implemented a KdTree. In some previous assignments we used existing data structures that were presented in class to do something. In this lecture, we were asked to implement the KdTree, which I thought was more interesting and instructive.

I just realized that this is the last programming assignment we will have. This upcoming week, we will have lectures on Hash tables, exercises and then the Final Exam. Hopefully, the exam pushes me to re-think all of the past material and review it so that it really gets engrained in my mind. I have to fight the instinct of trying to just get a good grade, and instead make my goal be getting a good working knowledge of these data structures and algorithms.

Hopefully, I meet that goal.

Saturday, February 20, 2016

Week 4 of algorithms part 1

The fourth week of my coursera algorithms course is done.

We learned about heap sort, binary search trees and priority queues. This is the first week when I feel like I am learning something that I am unfamiliar with. In previous weeks, I had a lot of experience studying and using all of the concepts already.

When I hear a problem, my mind visualizes the data using a few common data structures (maybe a stack/queue/sorted array or list/or a tree). For some reason, I don't immediately think about priority queues. This week's lectures reminded me of the importance and power of them. I think I should go back and review the material one more time to further engrain the concepts.

Because I had a day off this week, I was able to finish all of the material this week with a lot of time to spare.

I look forward to the upcoming week's lessons. In it, we will learn about red/black trees and other balanced search trees. This is one of the holes in my computer science knowledge that I'd really like to eliminate.

Saturday, February 13, 2016

Review

Some good things, some not so good things about me:

Work

Based on feedback from managers and my interactions with colleagues, I think I have been doing good work. Taking a step back, I feel like I have been living scared. I haven't gone on any interviews since I got my job years ago. I should be more active, and less scared of rejection.

Health

I am very pleased with my daily kettlebell training. I feel more fit, but I'm not sure how much. I need to keep better track of what I am doing (ie. how many 1 arm swings/push ups/pull ups/ etc ... per day), so that I can know if I am making progress.

Mental Health

I have pretty much given up meditation. It's boring. I have substituted it with early morning stretching. I am considering waking up about 30 minutes earlier so that I am less rushed in the morning, which may give me more time to meditate.

My dog

I have been trying to find the optimal walking schedule for my dog so that she never has to go in the house. We have cut down her need to use the wee-wee pad from every day and every night to almost never using it at all.

Writing

I have been writing in my private daily journal consistently, but the quality of my writing still feels pretty poor. I'm not sure how I can improve or track my progress.

Learning

I have been keeping up with my coursera course. I am on track to finish the course. This'll be the first one I finished.

Family

Family life has been good. I think I have been better at listening to my wife. I have been communicating more with my brother. My mom is coming back with my brother soon.

Eating

I have some good and bad weeks with respect to cooking and eating. For 90% of my life, I haven't been much of a cook. Recently, I've started making chicken soup from scratch and kim chi jigae (the chicken soup for koreans). I'm eating more salads for lunch. So things are improving.

Korean

I have made little progress. I'm still pretty diligent in doing Anki flash cards. I add four new sentences per day. And, I have been watching a few Korean movies and shows on Netflix. I signed up for an iTalki account so that I can practice speaking. I think this would be the best way to improve, but I haven't committed to doing any sessions.

Other projects

I have pretty much stopped working on any other outside projects. I have used all of my time working on other things like coursera, journaling, etc ..., which I mentioned above.

Week 3 of algorithms part 1

The third week of my coursera algorithms course has just gone by, but I didn't have enough time to finish all of the work.

I started the week OK by completing the lectures and exercises during the weekend. But during the week, I had to go into work early a few times, and I fell behind. I finally submitted the programming assignment this morning. I got a 98.something, with some deductions on performance in one of the test cases. I'd like to get all 100s, but oh well.

This week, we learned about merge sort and quick sort. Even though I was familiar with both of these sorting algorithms before, I think the lectures and exercises really helped me solidify my understanding of both of them.

For me, the most challenging part of the programming assignment was figuring out how to use a "Comparator". That's due to me not being a Java developer. Once again, the programming assignment had very little to do with the lectures or helping me understand sorting algorithms. I don't understand the point of these programming assignments.

This upcoming week, I have an extra day off (President's day) so hopefully, I can go over the previous week's job interview questions and still finish the week's assignments on time.

Sunday, February 7, 2016

Week 2 of algorithms part 1

I have finished the second week of my coursera algorithms course.

Last week, I felt a little bit short on time, so I shifted things around a bit. On the weekend, I completed all lectures and exercises. During the week, I was able to finish the programming assignment in a couple of days and then comfortably go through the job interview questions. Getting the lectures and exercises done on the weekend is the key to me doing the work carefully instead of rushing to the end.

The exercises can be a bit annoying. I often had to do them multiple times because I kept getting one of the true or false questions wrong. On the plus side, it forces you to go through the algorithms carefully a bunch of times.

This week, we learned about stacks, queues and some elementary sorts. As a real programmer, we use these so often without thinking about how they are implemented. It's good to dig into the details every once in a while. Hopefully more complex topics are on the way.

The programming assignment was a little bit more interesting this week. We built data structures that were modified versions of the stacks and queues that we learned about in class. This was better than the previous week where we just used API's that used the data structures discussed in class.

The other thought I had while working through things this week was how nice Java + the eclipse IDE is compared to my normal C++ + vim working environment. On the IDE side of things, the autocomplete is so nice. On the language side, a feature like "Implements" seems much cleaner than in C++. In C++, we'd have to inherit a pure virtual interface class. While logically equivalent, it seems a little bit cleaner in Java. However, that might be a biased opinion, as I am a C++ programmer who is learning Java.

Thursday, January 28, 2016

Week 1 of algorithms

I have just finished the first week of the coursera course Algorithms, Part I.

We learned about the union find algorithm and how to do some basic analysis of algorithms. I enjoyed the presentation of the union find algorithm (from an initailly naive implementation to a more robust final solution). The material on analyzing an algorithm is of course important, but a little drier and less fun for me.

The quizzes were helpful in forcing me to work through the gritty details of the lectures again. It often took me about 3 tries for each quiz before I got a perfect score. I think each failed attempt forced me to really think about the material.

I didn't really enjoy the programming assignment this week. Setting up the IDE was a chore. The assignment wasn't really about algorithms. It was more about using an API than understanding algorithms.

One of my worries before starting the course was whether I'd have enough time to do all the work. After one week, I'm still worried. I finished all of the work for this week before the next lecutre comes out tomorrow, but it was close. I didn't have much time to review the optional job interview questions. If the material gets more challenging, I may run out of time. To give myself some more leeway, I think I'll have to cover more material on the weekend.

Sunday, January 24, 2016

Back to School

I have just started the coursera course Algorithms Part 1.

I half-heartedly tried out the course before. I listened to some of the lectures, I glanced through some of the exercises and programming assignments, and I may have tried to do some quickly (using Python instead of Java). But this time, I am going to give it a good effort and do all of the assignments and try to really complete and pass the course.

On Friday, the course began, and I started watching the videos. After the introduction video, I found it easier to just read the lecture notes and the slides. It was quieter and I felt myself concentrating a little bit more. As things get a bit more complex, I may watch the video, especially when there are demos that don't animate in the slides.

By Saturday, I finished the first round of lectures, and I began looking at the programming assignment. Since it's the first assignment, I've been spending a lot of time getting my environment set up. I tried the recommended IDE called Dr Java, but it felt a bit unpolished. I decided to use Eclipse, which I had to re-install. Eclipse is not as light-weight, but I think it makes things a little easier to do, especially since I am a novice Java programmer.

It's a bit annoying getting all of this started. I wish they had set up an initial pre-class assignment before. Before the class started, I could have tried to set things up, and we could have had a simple HelloWorld style project where I could iron out the process of creating files and submitting them. Oh well, once I get this working right, hopefully it won't be so bad in subsequent weeks.

Ok, time for breakfast, and then I will go ahead and give the first week's programming assignment a try.

Monday, September 16, 2013

Always improving

As a programmer, most of my day is spent programming.  While programming is fun, it can be tiring.   Unsurprisingly, some days I don't have the energy to code.

In those times, it's good to have something else to do that is productive.  Here are a few things that I've been doing to stay busy.

Coursera

When I am tired of coding, it's nice to just sit and watch something.  I am taking a databases class.  It doesn't have a strict timeline, so I can watch a course or two whenever I get a chance.  I am familiar with databases, but I have never taken a structured course on them.  Therefore, I learn something in each lecture, but it isn't too mentally taxing.

Practice typing

I read a rant about the importance of typing fast.  From that reading, I realized that I am not good at typing numbers.  I didn't even know which fingers I was supposed to use when typing numbers.  So whenever I want something truly mindless to do, I go to a site that helps you practice typing.

VIM plugins

I heard of vim plugins before, but I didn't really ever use them much.  I imagine that once I begin using them, I will realize how useful they are.  I started by installing pathogen.  I then installed NERDTree, syntastic, easymotion, and sensible. Some of these (pathogen, syntastic and sensible) are really simple to use and work right out of the box.  NERDTree and easymotion are also easy to use, but the more you practice using them the better you will be at using them.  Playing with vim plugins is fun and hopefully makes you more productive - whenever you do decide to start coding again.

Tuesday, September 3, 2013

First time using coursera

A few days ago, I registered for my first class using coursera.  Coursera provides free online courses from top-notch educators.  The first class I am taking is https://class.coursera.org/db/class, by Jennifer Widom from Stanford University.

I use databases pretty often, so I expect to be familiar with a lot of the material.  Nevertheless, I hope the course will help me fill in gaps of knowledge that I might have missed and organize my understanding of databases in general.

So far, I have only watched the first lecture, which was just introductory material on databases.  Here are my some things that I liked.
  • The quality of the video and audio is good.  It is clear and clean.
  • The video has subtitles, which I turn on even when I have audio on.  
  • The video also lets you change the playback speed. I set it to 1.25x speed.  When I come to a lecture where the material is more unfamiliar or a bit difficult to understand, I can reduce it back to normal speed. 
  • Each lecture is relatively short. The longest one goes for 30 minutes, but many are around 15 minutes.
  • The ability to pause and rewind is great and much better than live lectures.  If I missed something I can rewind and try again.  Or, I can go on the internet and search for a different explanation.  I can then move on with the lecture when I feel ready. 
Overall, I think coursera is a pretty great service, and I hope that I persevere long enough to benefit from it.