Source: Monkey Math
Part 1
Given a series of equations of either the form
dbpl: 5
orcczh: sllz + lgvd
, determine what the value of the node labeledroot
is.
Given a series of equations of either the form
dbpl: 5
orcczh: sllz + lgvd
, determine what the value of the node labeledroot
is.
Part 1: A tree is defined as such:
node (weight) -> child1, child2, ...
node (weight)
Where a
node
always has a weight, but may or may not have child nodes.
What is the name of the root
node
of the tree (the node without a parent)?
Inspired half by a post on the Code Golf StackExchange and half by the corresponding website allrgb.com, today’s post tasks us with making images like this:
So what’s so interesting about that picture?
Today’s task comes from the Code Golf StackExchange. The idea behind code golf is to write a program with as few characters as possible, often rendering the code nigh on unreadable. Luckily, the same StackExchange also host popularity contests, one of which is the inspiration behind today’s post:
You are given two true color images, the Source and the Palette. They do not necessarily have the same dimensions but it is guaranteed that their areas are the same, i.e. they have the same number of pixels. Your task is to create an algorithm that makes the most accurate looking copy of the Source by only using the pixels in the Palette. Each pixel in the Palette must be used exactly once in a unique position in this copy. The copy must have the same dimensions as the Source. – American Gothic in the palette of Mona Lisa: Rearrange the pixels
Another five minute challenge1, this time from /r/dailyprogrammer: given any positive integer, create and render a factor tree.
Pretty pretty picture time1:
So far this week we’ve had a pair of related posts at the DailyProgrammer subreddit1:
Basically, if you’re given a string with vowels, take them out. If you’re given one without vowels, put them back in. One of the two is certainly easier than the other2. :)
Yesterday’s post from Programming Praxis has us trying to find the predecessor and successor to a given value in a binary search tree. There are actually two general algorithms for doing this, depending on if you have parent pointers or not–but they’re asking for the algorithm without.