14Jun2022: Hackathons, Recursive functions, DS&A

Written by Catt Tung on Jun 14th, 2022 Views Report Post

So today I've been feeling a bit burnt out from a few personal things that have been lingering in my life - something like my spiritual garden needs tending but I've still been ploughing away at everything going on. So I may have to look into that, but I can still do a few things daily on coding for sure, even just one coding challenge.

Hackathon talk

I attended a live Zoom talk from Codementor/arc (which my friend in Taipei runs) on attending Hackathons. It was really cool to see how this girl in India went from doing loads of Hackathons to landing her role as a software engineer in Microsoft. Having done intense projects at GA myself, I imagine Hackathons are super high-growth experiences, especially when you work with others and their intentions can push you to do things you might not have done. I'd like to look into Hackathons for sure as we used to hold them at balena and it's cool, you just have to start somewhere I suppose. This talk was pretty encouraging for at least taking a look into it (or adding it to my never-ending trello board).

Recursive functions

I am still writing that LeetCode from yesterday - my friend gave me a bit of help, but when I reviewed the code she sent me I realized it didn't cover for a few cases that the problem described. I know what I want the function to do but it's been a bit tricky to figure out how to get it to where I need it to be. I still have to adjust for the condition that would end the recursive function. I really like what she shared with me though, in terms of how to write a recursive function overall:

var recursiveFunction = function(inputArg, resultsOfRecursion) {
  if (conditionForEndingTheRecursion){
    return resultsOfRecursion
  }
  some activity that alters the resultsOfRecursion based on the inputArg
  return recursiveFunction(newInputArg, updatedResultsOfRecursion)
}

This is the main skeleton of a recursive function and I hope I'll have more practice so I can get better at it.

Data Structures and Algorithms

I revisited the Merge Sort today - it's so interesting. It's splitting up a list into individual 1 item lists, then combining them two at a time, sort those, then take the smaller number from the pair to compare to the first index of one of the other lists, then continue to do that until it's all sorted. I really like that and again it's recursion (a coding theme for me these days!) - so if the function is merge_sort, first split the list in half, then put those halves into the merge_sort until it splits again until the list is 1. Then the merge code comes up, merging these lists with 1 value into a sorted list and saves those 2 values as one part of the list. It continues to do this with each value as the "half lists" build up into actual halves, but sorted as it compares the first value of a half list to the first value of the other half list.

I think I'm getting it right. Recursive functions kind of make my head spin a bit unless I'm following it out line by line and holding values on my fingers so I can get the right values. Good practice though, I hope to improve on recursive functions.

Overall I think while we studied this a bit at GA, it's not easy to grasp these computer science concepts unless you really do something with them, but the frequent review might also help me in understanding it better as I build things out. Also...the book is in Python but my preferred language for doing coding challenges is JavaScript - it's just a bit challenging because I think a lot of it is about learning/knowing how to translate what I want to function in my head to the programming language..I mean of course that's coding's whole deal.

Also random funny note, I was making a giant iced coffee today and I thought of that line in Glengarry Glen Ross that my friend Greg had shown me years ago, where Alec Baldwin's character is yelling at Jake Lemmon's character "Coffee is for closers only" Well in my head today it came out as "Coffee is for coders only"

Catt xx

Comments (0)