Advent of Code F# – Day 13

ps. look out for all my other solutions for Advent of Code challenges here.   Day 13 See details of the challenge here. Today’s challenge involves solving two separate problems: counting set bits in an integer level order tree traversal For the first problem, I recommend reading through this blog post which covers several approaches and optimizations for this …

Advent of Code F# – Day 13 Read More »

Implementing a BST in F#

Binary Search Trees (BST) seem to be a hot topic in technical interviews. So, in order to help me prepare for all these grilling technical tests, I thought I’d give it a crack at implementing insertion, deletion and verification logic since I’ve already done both breath-first and depth-first traversals.   Verification Starting with something nice and …

Implementing a BST in F# Read More »

Depth-First Tree Traversal in F#

We looked at breath-first tree traversal earlier today, now let’s take a look at depth-first tree traversal as well. Here, we loop through the tree starting with the root, yield the value for each of the nodes before recursively traversing down all the left branch first and then the right branch.   Try it Yourself   Links Breath-First …

Depth-First Tree Traversal in F# Read More »

Level Order Tree Traversal in F#

Another common problem I see during my preparation for technical interviews is the Level Order Tree Traversal (or Breadth-First) problem. I always like to think with my F# hat on when I solve algorithm problem, so here’s an implementation in F# . Here we have a nested recursive loop function that: yields the value from the nodes …

Level Order Tree Traversal in F# Read More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.