The following java method calculates the sum of a polygon given a list of the points in either clockwise or counter clockwise order: private double calculateArea(List<Point> orderedPoints) { //multiply each x coordinate by the following y int positiveDiagonalSum = 0; … Continue reading
Category Archives: Algorithms
Expensive Dinner
Problem: There are N people going to a restaurant, entering one at a time. Each person is unhappy upon sitting down if the total bill does not equal a multiple of that person’s integer identifier. So, person “3″ will not … Continue reading
Markov Chains
A markov chain is built by tracking the order data occurs in. We can then take this observation and create new data that will closely resemble the initially observed data. With enough data to analyze, this allows the creation of … Continue reading
Quick Sort
The quick sort partitions objects into two groups, one group of the objects with a value above a certain value, and another group with a value below. Each of these groups is further divided, and this action continues recursively until … Continue reading
Picking Up Chicks
Problem: A number of chicks in a straight line begin running at different speeds, starting at different points along that line. When a speedy chick catches the chick in front, it slows to the slower speed. You are following in … Continue reading
Number Game
Google has an annual programming competition called “code jam”. There are multiple rounds, each consisting of 3 problems to solve. They leave the old code jam websites up and it is a great place to find interesting problems. They also … Continue reading
On Beauty and Algorithms
Algorithmic beauty is the same as algorithmic usefulness. Beauty is simplicity, beauty is elegance, and beauty is efficiency. This blog is about solving problems of all kinds. Algorithms are much more than snippets of computer code. A computer follows algorithms … Continue reading