Home

18Jun2022: DS&A

Created June 18, 2022

Today has been really great fun, I started off the day on a good foot finally (thank goodness for not having splitting migraines) with studying more data structures and algorithms in The Self-Taught Computer Scientist. Actually, before I did that, I set a bunch of deadlines on when to finish chapters and sections on this book - it's a really simple and straightforward book but I think it helps to consume it over time because cramming in all these different sorts and tables and what nots in one go is not a way to retain the information. I also have CS50 to work through so I will see them again, as well as General Assembly's course videos, as well as rewatching the recordings we did in class. So, there is a lot of repetition going on, and repetition really is the mother of learning. I darn well learned Bulgarian on my own with repetition so this will definitely get me somewhere - I believe at least.

I completed the chapter on sorts and loved the example on the efficiency of a merge sort (or actually divide and conquer algorithms) where if you have a class of 50 students each with some amount of money, how do you find out how much money the whole class has? You could have the teacher go through one at a time and add them up, which would be O(n), or if you do it merge sort style, have each student partner up, add their values together, have one student leave the group and the other stay, repeat the process, and you accomplish it in 6 steps!

What I find interesting is you can't think of it in terms of economics (as an economics major) - because thinking of it economically, I would think but the first calculation is still 25 steps, then the next 12, then the next 6 (or 7), then the next 3 - so it's still more or less 50 steps! But here in the world of computers, they don't get tired I guess. Very interesting paradigm difference. I wonder if it can apply to real life, or is this just computers.

Apart from that, the chapter on String Algorithms is also incredibly helpful. Anagram, Palindrome, Caesar Cipher - all good ones to know. I learned about list comprehension, which is basically like .map in JavaScript, where the original list is not mutated and a new one is created with the different qualities (eg. filter for an even number). The syntax is - list_comprehension = [expression(i) for i in iterable if filter(i)]

I'll look forward to practicing these methods until I'm really good at them - honestly though I've been solving all my coding challenges in JavaScript - switching between the languages is always a bit tricky.

Catt xx