Category: Computer Science
-
Where discrete mathematics meets an interview question
Last week, I was sitting behind my desk at work, surfing hacker news and and at the top of the website floated an article by the co founder of “Daily Coding Program”, a small tech start up that e-mails daily newsletters with a programming question. The article shared some of their insights over the past…
-
Lessons learned coding the quicksort algorithm in assembly (i.e. MIPS)
About six months ago, I enrolled myself in a computer organization (i.e. CS1410) course offered by University of Northern Iowa and I’m taking it remotely from Seattle, where I work full time as software engineer at Amazon (Web Services). I’ve completed about two thirds of the course, which consists of sixteen homework assignments and three…
-
A brief introduction to cache organization
As a software programmer, I always had a vague understanding of how an operating system fetches data from memory. At an abstract level, I understood that a processor requests data from the memory controller, sending a message (with the memory address encoded) across the bus. But I learned recently that in addition to the system’s…
-
Defusing a Binary Bomb (phase 1)
http://blog.itsmemattchung.com/2017/02/28/csapp-defusing-the-bomb-phase-1/ I password protected the original post (email me for the password if you are interested in reading it). When I posted the original link on reddit/r/compsci, multiple commenters suggested that I delete the article to avoid students from cheating (which was not my intention). I then sent an e-mail to the professors (at CMU) and they kindly replied, asking me…
-
How does the modulus operator work?
As a programmer, I’ve written a line or two of code that includes the modulus operator (i.e. “return x % 2“). But, never have I paused to think: “How does the underlying system carry out this operation?” In this post, I limit “underneath the hood” to the lowest level (human readable) programming language: assembly. So, I’ll take…
-
Calculating page table entry size
How many page table entries are required given a virtual address size and page size? I was confronted with this question when reading Computer Systems from a programmer’s perspective on virtual memory management (VMM) which forced me to reread the chapter, over and over. It wasn’t until I forced myself to close the book, step away from the…
-
A simple C problem
I’m slowly working through “Computer Systems from a programmer’s perspective” [1] , struggling every bit of the way. I stopped beating myself up about it, though. The code snippets below are in C. The first function, inplace_swap, swaps two integers. The code itself looks lacks intent but I promise you, it swaps two integers. The…
-
Teaching as a form of learning: Binary Search Trees (BST)
Last week, an e-mail was sent out to an internal mailing list [1], looking for volunteers to lecture on data structures & algorithms topics, but nobody replied. I jumped at the opportunity. I volunteered to lecture on binary search trees, without any previous knowledge on the topic. Why in the world would I volunteer to…
-
Python progression path – quiz
Python progression path – From apprentice to guru is a popular StackOverflow post. To categorize whether a person should take his beginner/intermediate course, one of the commentors posted this question: I can better answer this question after reading Fluent Python. Example 1 and Example 2 deal with immutable and mutable data types – respectively. Let’s…