Operational Costs of Printers and Running Times of Arrays with Amortized Analysis

The running time of data structures is not obvious without making assumptions on the current state of the data structure under speculation.

As a programmer and an algorist, I find myself computing the operating cost of devices that I intend to purchase. In my recent shopping endeavors, I was in search for a printer with simple requirements: it must be a laser printer that prints pages in grayscale. Once my range of options have been narrowed, it comes down to selecting the most cost-effective option: which printer has the cheapest cost per page printed?

Planning a Dual Boot Partition Scheme with OS and Data Separation

Operating System and data separation on a drive is important for failure isolation.

We will begin by motivating the need for OS and data separation. Consider the following situation: Bob has a single disk on his laptop with a single partition containing a Windows installation. One day Bob is no longer able to boot into this partition; let’s say that he’s stuck in the loading screen. Now, Bob has the option of reformatting the partition or restoring a backup. Both options may cause data loss. Bob could have easily prevented the data loss if he had simply separated his operating system and data into separate partitions! Of course, I happened to be Bob a few times and thus I decided to solve the problem once and for all.

In this post, we will cover my grid method for designing partition schemes for dual-booted Linux and Windows. This partition scheme is not for everyone; in particular, this is intended for programmers on laptops that are limited to a single drive that must be easily managed and vertically scaled.

How to Choose a Good AR Drone API

Every now and then, I find myself in a regrettable foray into a deeply technical project for a ridiculous cause. Fortunately, I wasn’t alone in this adventure.

My ACM student organization and I have been toying with our new AR Drone. The goal is for the drone to deliver tacos autonomously. Of course, this objective has several obstacles: buildings that obstruct paths, birds that steal tacos and customers that refuse payments.

The project and its subproblems seem qualified enough to be worthy of an exploration into drones. We begin our exploration with a API choice and I will elaborate what we mean by a “good API.”

Posted in Inspiration | | 3 Responses

Exploring Functional Programming in Scala through HackerRank

Practice is one of the best methods of learning a new language and its idioms. Since HackerRank recently released a new category problems, Functional Programming, I decided to learn Scala by first studying its functional aspects.

Although the problems are easy, introductory problems still have potential to demonstrate good practices as I’ve learned. The language was pleasantly concise and expressive as Python is in terms of its anonymous and higher-order functions. However, the distinguishing features (and the highlights of this post) are Scala’s method invocation conventions and the placeholders.

This post will explore effective use of Scala-specific features as well as good practice learned from introductory-level problems. I assume that the reader is familiar with closely-related programming language such as Python or Java and is vaguely familiar with notions such as anonymous functions and higher-order functions.

Posted in Inspiration | | 3 Responses

Illustrated Decomposition of Combinatorial Game Move Enumeration with Basis Vectors

Partisan, combinatorial games such as Checkers, Chess and Othello are easily implemented on a matrix implemented as a square array; however, the enumeration of feasible game moves on the game board is a laborious coding effort if implemented naively.

I will illustrate a method for decomposing combinatorial game moves to basis vectors on a matrix. The advantage of this method is that the code becomes concise relative to the naive method for representing potential game moves.

Concise Implementation of Minimax through Higher-Order Functions

The Minimax algorithm is the core of several game-playing AI for making decisions on the best move. This algorithm finds the best move for an AI on a two-player, combinatorial game state on games such as Checkers, Chess or Othello.

In this post, I assume that the reader is familiar with the algorithm and its inherent code size due to its frequent implementation with three distinct functions. I will begin by briefly describing a standard implementation of Minimax and then I will introduce a concise implementation using higher-order functions. Note that we will use Python and Haskell as pseudo-code.

Posted in Ingenuity | Tagged , , , , , , | 1 Response

Designing a Linux Resource Manager in C++

By the fervor of Linus Torvalds, there does not exist any immediate C++ or OOP interfaces to operating system services. Consequently, it is sometimes necessary to wrap a logical set of Linux system calls in a C++ wrapper.

In this post, I will demonstrate a standard process of wrapping the resource limitation and usage system calls in a ResourceManager singleton service while utilizing some nifty C++ tricks such as CRTP.

Posted in Inspiration | | 1 Response

MinDispatch: Event-Driven Framework In Java Part 2

From the last post in this series, we developed a fixed, event-driven chat simulation. In this post, we will extend this example by refactoring. The objective of this tutorial is to teach effective design patterns in an event-driven model.

First we will begin by designing the structure and behavior of the user and chat to describe our application. Second, we will bind the aforementioned chat state to the event handlers to fix constant parameters. Finally, we will use an event queue for separation of concerns.

Partioning Discussion Sections for Lecture-Hall Sized Classes

Eric Hennigan had recently pitched a new partitioning problem to ACM: partitioning his discussion sections among two TAs such that students are equally distributed to each TA. Although the problem may be trivial to do by hand, it’s easy to decompose into discrete mathematics, and therefore, easy to analyze.