## Finding the Must-pass, Shortest Path Nodes in a Graph

The following is a problem given as a lab assignment for my Graph Algorithms course that I’m currently taking. It’s a pretty interesting problem and I enjoyed coming up with the solution. Problem Fatima commutes from KTH to home by subway every day. Today Robert decided to surprise Fatima by baking cookies and bringing them…

## Find the middle element in an int list (SML/NJ)

The following is a function that I wrote as an assignment for my Language Design class that returns the middle element of an integer list. fun middle lst = let fun reduceByTwo ([],onelst) = hd(onelst) (*When our twolst is empty we are at the middle*) | reduceByTwo (twolst,[]) = 0 (*This should never happen*) |…

## Project Euler | Problem 1 (Multiples of 3 and 5) Solution

If you’ve ever heard of or worked on the coding problem FizzBuzz, this is somewhat similar in the sense you have to check a set of n numbers for multiples of 3 and 5. However, rather than printing out different strings depending on which numbers it divides, we add the sum of all the multiples…

## Project Euler | Problem 7 (10001st prime) Solution

Problem: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? Explanation and Thinking My teacher gave us the hint that we should only be searching up to the √n where n is the number…

## Project Euler | Problem 4 (Palindrome Product) Solution

As a part of my Discrete math class this quarter, my teacher has assigned us a few of the problems from Project Euler. If you are unfamiliar with this project, it is a “series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.” Being a much bigger fan of…