I think I’m not alone in suggesting that the tree, and perhaps the binary tree specifically, is the most foundational data structure in computer science.
This raises the question of how binary trees should be introduced, and I’d like to make the case that introducing binary trees as a special case of undirected graphs is not a good idea.
I can see reasons why you might think this is a good idea; they both involve connecting circles with straight lines on the board. If you take the general notion of a graph, and you happen to arrange the lines and circles in a particular way, it’s a tree. That kind of suggests that graphs are a generalization of trees, and that you might want to introduce trees as a special case of these graphs.
Please do not do this.
Specifically, my claim is that this produces a complex definition of trees with many global constraints, a definition which makes it very hard to prove some simple things.
Let’s see why.
Trees as Undirected Graphs
To begin with, consider the definition of a graph, a set of nodes along with a symmetric binary relation on nodes that we call “edges”.
In order to construct the set of trees, we can restrict this definition in the following ways.
A tree is a graph with the following properties:
It is connected,
it has no cycles, and
we designate one node as the root node.
All three of these are global constraints, and checking the second is genuinely quite complex, especially for a first-year student.
Suppose now that we want to identify the descendants of a node. This is where things start to get really unpleasant. The descendants of a node are the adjacent nodes that are not the parent node. But which is the parent node? The root node has no parent node. For other nodes, it is the adjacent node which is the first along the path to the root node. Again, this is not a simple process; if we provide a symmetric edge relation and a parent node, determining the path to the root node (and thus the parent node (and thus, by elimination, the descendants)) requires potentially a full search of the tree. Yes, this can be cached. Yes, it doesn’t matter whether you do a depth-first or breadth-first search. It’s still a lot of work.
But wait! Suppose we want a binary tree? Firstly, we must ensure that every node has at most two descendants, which is the same as ensuring that the root node has at most 2, and every other node has at most 3. That’s the easy part, though. In a binary tree we typically care whether a child is the left child or the right child; adding this to a graph representation requires labeling every node as either a left child or a right child, and then checking to make sure that no node has more than one left or right child.
Inductively Specified Trees
Okay, so what’s the alternative?
The alternative is the inductive specification of a binary tree: a binary tree is either an empty tree, or it is a node containing a left tree and a right tree.
This representation is essentially a tree by definition; no global checks are required. Asking whether a binary tree specified in this way is a binary tree is genuinely trivial: only binary trees can be specified using this schema.
You could argue that inductive specifications are hard for students, and I wouldn’t completely disagree, but I would also argue that the overwhelming simplicity of this definition of binary trees powerfully outweighs the challenge of becoming comfortable with inductive specifications.
Identifying the descendants of a node here is essentially trivial; an empty tree has no descendants, a non-empty tree lists its two descendants.
Freebie: this representation also sidesteps the irritating issues around identity which bedevil programmers everywhere.
What about directed graphs?
Trees as Directed Graphs
Directed graphs are considerably better than undirected graphs. But still way worse than the inductive specification. Specifically, you need an undirected graph that is connected and with no directed cycles, and you also need an additional constraint that at most one node points to another one (making the arbitrary choice that the edges point from parents to children). Checking these constraints still requires examining the whole graph. Identifying the child nodes is much nicer. Distinguishing the left and right children is still a serious problem.
Done
To summarize; it’s reasonable to talk about the correspondence between these two representations. You might even want to try to prove them isomorphic. But please don’t introduce trees as a special case of graphs.
Yesterday was the election! It looks like Donald Trump is going to be our next president. The democrats lost.
As much as it pains me to write that, the simple truth is that it doesn’t help anyone or anything to be cynical, or to flip out, and it really doesn’t help anyone to doom-loop on terrible possible outcomes.
So, just to remind myself, here are some things I think are important, and worth fighting for:
Human Rights
Rule of Law
Freedom of the Press
Slowing Global Warming
Really, it all comes down to Human rights; I want to work hard(er) to ensure that others have the right to life, liberty, and the pursuit of happiness.
To be clear, I do think that these things are under threat, and probably will be for the forseeable future. In particular, the Rule of Law and Freedom of the Press are “enabling technologies” for Human Rights; I believe that the United States of America continues to be at the forefront of a grand political experiment in how best to ensure the rights of all its citizens, and that the Rule of Law and Freedom of the Press are vital cornerstones of our system; without them, other things can crumble quickly, as we’ve seen in dictatorships all over the world.
So there, I also said “dictatorship”. I do not think that we are somehow magically immune from dictatorship, and I do think that we are constantly called upon to bolster our government and to oppose attempts to seize control. I don’t know what shape those attempts will take, but I hope that I have the strength to raise my voice against them when they do.
I realize that I haven’t said anything about Global Warming.
Okay, quick aside: can we go back to just saying “Global Warming”? The “Climate Change” phrase is no longer helping, I don’t think.
Anyhow, I do think that climate change is potentially the most destabilizing force to governments and people today, with the potential to kill millions of people (this is already beginning) and to cause wars and famine. I think the evidence for global warming is almost comically solid at this point, and we need to be doing much much more to slow it down.
To go back to the title: I’ve seen this movie before. It sucked. But I didn’t die[*]. I can get through this, and it does not help to panic, and being angry all the time is probably not a recipe for health, sanity, or forward progress. I’m going to try to do what I can, and stay calm. I pray for you and for your family. Take care of yourselves.
Hmm… well, that was harder than it used to be. Probably I’m just getting old.
Okay, rewind. This year was the 29th swim! The water was a good deal colder than it has been in the last few, and the choice of date meant that the tide was not compatible with an inbound swim, so our swim was (for the second time ever) from the Becton’s dock out to the island. Besides meaning that swimmers couldn’t see much in the way of landmarks, it also meant that the water got colder and colder as we approached the finish.
Justice had the bright idea of borrowing race markers to help guide the swimmers and the chase boats, which was quite helpful. Who knows where we would have ended up otherwise.
I personally cannot comment much on the pointy end of the swim; I was slow slow slow, and by the time I crawled out of the water the rest of the swimmers were relaxing in easy chairs, sipping martinis. Not quite but pretty close. This was definitely a wet suit year.
Many kudos to two first-time swimmers: Mike Keene, and Laura Lutton. I would like to offer a huge shout-out to Laura for her entering-the-water howl, which kept me going for most of the swim. This was also the fifth swim for Ted Heyd and Pat Starkey, a tip of the swim cap to them.
This was also a year that honored Jeannie Becton, who is no longer among the living, and will be forever missed. Swimmers and others made donations to the Heritage Trust in her name.
Next year will be the 29th anniversary, and the 30th swim. Goodness.
The year is 2022. This is the 28th swim, and it was warm, and it was quite calm. Really, a balmy morning all around. The big news was that we picked up another multi-generational team, and there were a total of 3 “next-generation” swimmers: Ahren Michaud, Lucy Lawther, and Liadan Taylor, in addition to first-time swimmer Renee Michaud.
This was also Justice Pollard’s 20th swim, a pretty substantial milestone.
We did this one with not much tidal assist, starting only 15 minutes after dead low. Maybe next year we’ll go against the tide! No, no, just kidding.
In other news, we missed those of you that couldn’t make it. Come back next year!
Swimmers:
Ahren Michaud
Charlotte Clews
John Clements
Julie Forsyth
Justice Pollard
Liadan Taylor
Lucy Lawther
Mark Read
Mary Clews
Renee Michaud
Inimitable and priceless support crew:
Andy Wanning
Anika Clements
Charlotte Taylor
Charlotte Weir
Guy Ardrey
Hal Clews
Henry Becton
Jeannie Becton
Neddy Clews
Wing Taylor
A special mention here goes to the Becton crew, who arrived with hot chocolate and pastries at the moment above all others in the year when they are most most needed. Thanks so much!
Many thanks to Andy Wanning and Anika Clements for the pictures that appear here.
Finally, and this is very very literally true, this event would almost certainly NOT have happened without Mary Clews, who herded the mackerel into the chute successfully.
I don’t have time to write an actual essay here, so I’m just going to take a 5-minute break from what I should actually be doing to share with all of you (my millions of adoring readers) a thought that I’m having while teaching engineering non-majors how to program.
To wit: For the last fifty years, cleverness has been extremely important in programming a computer.
But that’s not really true any more, at least not for the vast majority of programmers.
But we still teach computer science like it is.
And I’ll stop starting my sentences with conjunctions now.
In the 1950s, 1960s, and 1970s, computers were generally speaking slow and small; fitting your desired computation into the time and space afforded by computation was a challenge. Programmers had to come up with clever encodings and clever algorithms. They did!
Now, in the 202s, computers are very large and very fast, compared to the programs that most of us want to run. There are exceptions, of course; weather simulations and “high-energy physics” still want as much computing power as they can get. Most of our computing tasks, though, are relatively more modest.
Unfortunately, we haven’t yet figured out how to teach programming in ways that focus on correctness and reliability.
Honestly, I think that’s because most of our teachers are still much more interested in working on problems that exercise their cleverness. There’s a strong parallel here to Math; for many math faculty, teaching a Calc 1 class doesn’t sound fun; there may not be much that’s challenging or interesting about the material, and much of the work is oriented around nurturing and caring for young minds, rather than inventing new and magical ways of thinking.
In computer science (which in many ways is just applied math), we haven’t yet reached this state, for the simple reason that we still have not developed the tools that allow people to efficiently generate correct and reliable programs. In other words, it’s not too late for cleverness! That cleverness, though, must be directed not at the students, teaching them how to write clever programs in complex and interesting languages; instead, it must be directed at the tools and materials that surround those students; we need to develop programming tools and teaching methods that efficiently endow those young minds with the ability to generate correct and
Another year! The 2021 swim is in the books. I must say, I’m still looking for a name for this event. Long Island Challenge is (it turns out) not a unique name. Granite Mon is unique but also very … dated? Also, a lot of the rock here isn’t granite. Okay, this isn’t a puzzle I can solve on my own.
Anyhow, predictions of a terrifying cold blob… did not come to pass. It was apparently very very cold (54F?) a few weeks ago, but the day itself—that would be yesterday—dawned cool and glassy with water that was just fine. It may be that in my dotage I have lost my ability to detect cold water, but I would have guessed 70s. Others said 60s.
The turnout was spectactular. We had fourteen swimmers, a new record! Here’s the list:
Alice Clements
Amanda Herman
Chris Guinness
George Pendle
Jerome Lawther
John Clements
Julie Forsyth
Justin Pollard
Lane Lucas
Lucy Lawther
Mark Read
Mary Clews
Pat Starkey
Tricia Sawyer
We had two new first-time swimmers, Julie Forsyth and, in the first ever intergenerational transfer, Lucy Lawther.
As always, there are many many people who get up at the crack of dawn in order to make this amazing thing happen. This year, that list included these amazing people and probably others that I’ve neglected to include (but lif so, let me know!):
Peaceful disagreement is the foundation of our American government.
It is not surprising that we disagree with each other. Each of us has individual opinions, circumstances, and understanding. Each of us sees a different part of the problems that surround us. Each of us has a different insight into the world, and sees different things that need to change.
And, for better or worse, pretty much all of us are justifiably angry about some aspect of government and society.
Our great virtue, as a nation, is that we have the ability to set that rancor aside; to suspend our anger, and to use the democratic process to decide upon a path forward. I don’t use the word “agreement”, because we may never truly agree. Fortunately, our nation and our government do not depend on our ability to agree with each other. They depend only on our ability to participate peacefully in a democratic process.
It has worked well since 1776. I have faith (and I do mean faith) that it will continue to work, and that America—the greatest nation on Earth—will continue to thrive and prosper, creating peace and prosperity and allowing each of us the pursuit of happiness.
So, this post isn’t very timely: hopefully COVID–19 will soon go away and we’ll all return to forms of education that actually work.
In the meantime, though, I’ve been learning things about online testing.
It probably goes without saying that there are many many differences between taking tests online and taking tests in person.
However, one of them that hadn’t occurred to me until very recently was how much more difficult it is… to not cheat.
Here’s what I mean. When you’re taking an in-person test in a classroom setting, your basic task is to focus your attention on your own desk. I’m not saying that’s easy for everyone, but I’ve come to realize that online testing presents an incredibly different experience.
Specifically, I think it’s safe to assume that most of the people in my courses taking exams still have their phones on. And what do you do if you’re taking a quiz, and you get a message from a friend, begging for help on a particular problem? You have to either deliberately snub them, or actually tell them “no”. Both of those are kind of hostile.
What this means is that we’ve taken an environment in which it’s incredibly easy to insulate yourself from those trying to cheat, and turned it into one where the burden is on those who don’t want to cheat to actively reject those who do.
So, I’m guessing that this is incredibly obvious to all of my students, but it sure wasn’t to me.
Is there an easy solution? Well, my easy solution would just be to turn off my phone during the test. But I suppose I wouldn’t do that unless the possibility of being asked for my answers occurred to me beforehand.
And, of course, this does absolutely nothing for the problem of students that actively conspire ahead of time to cheat.
So, although it’s a little late to do this now—the exam is in two days, and we can’t really discuss it in person—I’m going to make this suggestion now: please just turn off your phone and put it in another room, for the duration of the test?
I was forwarded this today. It’s a speech given in 1944 by Judge Learned Hand, on “I am an American” day in 1944, in the middle of a terrifying world war.
The first few sentences are somewhat hard to read; his assertion that we are made of people that have chosen to immigrate or are descended from those who did rings terribly terribly false for the thousands and thousands of slaves that were brought to this country in grotesque conditions, entirely against their wills.
Can we move past this? I hope we can, because his statements about Liberty, and the distinction between Liberty and the simple anarchy of unbridled will, are incredibly powerful and relevant in January 2021, when we face an insurrection of those who seem to believe that “do what thou wilt shall be the whole of the law.”
We have gathered here to affirm a faith, a faith in a common purpose, a common conviction, a common devotion. Some of us have chosen America as the land of our adoption; the rest have come from those who did the same. For this reason we have some right to consider ourselves a picked group, a group of those who had the courage to break from the past and brave the dangers and the loneliness of a strange land. What was the object that nerved us, or those who went before us, to this choice? We sought liberty; freedoms from oppression, freedom from want, freedom to be ourselves. This we then sought; this we now believe that we are by way of winning. What do we mean when we say that first of all we seek liberty? I often wonder whether we do not rest our hopes too much upon constitutions, upon laws and upon courts. These are false hopes; believe me, these are false hopes. Liberty lies in the hearts of men and women; when it dies there, no constitution, no law, no court can even do much to help it. While it lies there it needs no constitution, no law, no court to save it. And what is this liberty which must lie in the hearts of men and women? It is not the ruthless, the unbridled will; it is not freedom to do as one likes. That is the denial of liberty, and leads straight to its overthrow. A society in which men recognize no check upon their freedom soon becomes a society where freedom is the possession of only a savage few; as we have learned to our sorrow.
What then is the spirit of liberty? I cannot define it; I can only tell you my own faith. The spirit of liberty is the spirit which is not too sure that it is right; the spirit of liberty is the spirit which seeks to understand the mind of other men and women; the spirit of liberty is the spirit which weighs their interests alongside its own without bias; the spirit of liberty remembers that not even a sparrow falls to earth unheeded; the spirit of liberty is the spirit of Him who, near two thousand years ago, taught mankind that lesson it has never learned but never quite forgotten; that there may be a kingdom where the least shall be heard and considered side by side with the greatest. And now in that spirit, that spirit of an America which has never been, and which may never be; nay, which never will be except as the conscience and courage of Americans create it; yet in the spirit of that America which lies hidden in some form in the aspirations of us all; in the spirit of that America for which our young men are at this moment fighting and dying; in that spirit of liberty and of America I ask you to rise and with me pledge our faith in the glorious destiny of our beloved country.
Based on their full-page advertisements in various newspapers, Facebook is extremely upset about Apple’s upcoming move to make cross-app privacy the default. Their two main “hooks” are that it will hurt small businesses, and make the internet less “free”. I believe that neither of these is the case.
What is clear to me is that this move will hurt Facebook’s ability to collect piles of information about its users, and to leverage that to collect huge amounts of advertising money.
The Current Situation
Before I go on, a caveat here: while I’m a programmer and a researcher, I am not a security and privacy researcher, so you should check the things I’m telling you.
With that said, a brief summary of the current situation: Currently, Apple’s iOS includes a notion of an “IDFA”, an “identity for advertisers.” This IDFA can be seen by apps, and apps can send information about what a user is doing in this app back to its central servers. This information can then be connected to other information uploaded by other apps in order to build a detailed picture of you.
This allows Facebook and others to understand what you’re like, and how best to separate you from your money by presenting you with advertising that’s likely to convince you to buy things. It also allows Facebook to identify characteristics that will allow them to present content that you will be really really interested in.
Back in June 2020, at their developer’s conference, Apple announced a change to the way that IDFAs would work. Since this is a developer conference, they were addressing app developers, and telling them how they would use their new framework to observe a user’s IDFA:
"To ask for permission to track a user, call the AppTrackingTransparency framework, which will result in a prompt that looks like this.
opt-in tracking dialog
This framework requires the NSUserTrackingUsageDescription key to be filled out in your Info.plist.
You should add a clear description of why you’re asking to track the user.
The IDFA is one of the identifiers that is controlled by the new tracking permission.
To request permission to track the user, call the AppTrackingTransparency framework. If users select “Ask App Not to Track,” the IDFA API will return all zeros."
So, which button would you click?
My guess is that relatively few people will click the “Allow Tracking” button.
This will mean that Facebook and other apps will not be able to observe your IDFA, and will not be able to use this extremely convenient way to gather and share information about you.
Small Businesses
What does this mean for small businesses?
Let me offer another caveat here, and tell you that I am not an expert on small businesses, their use of targeted advertising, and the effectiveness of their use of targeted advertising.
However, I’m going to observe that small businesses, by and large, are hurt by online advertising in general, and are unlikely to have the kinds of data science teams that are best positioned to sift through and profit from reams of consumer data.
Some (like Facebook?) might respond that their interfaces are designed to make high-quality data analytics available to even businesses that don’t have giant data science teams. I don’t think this argument holds much water, and I think that whenever Facebook provides better information on their users, companies with high data-science ability will be the ones best positioned to capitalize on it.
Facebook makes the specific claim that “Facebook data shows that the average small business owner stands to see a cut of over 60% in their sales for every dollar they spend.” This claim is (I claim) fairly preposterous; I’m guessing that they’re measuring the relative effectiveness of targeted and non-targeted advertising. What this ignores is the fact that people are still going to buy things, so that if targeted advertising goes away, more dollars will go toward non-targeted advertising.
Of course, they might be right, in the situation that the stuff that people are buying because of targeted advertising is worthless junk that they didn’t need. In that case, maybe targeted advertising is really important because it allows advertisers to sell us worthless junk. I’m not sure that’s a good argument for allowing targeted advertising.
The Free Internet
Next, Facebook makes the argument that this move is in opposition to the “free” internet. Specifically, they argue that “Many [sites] will have to start charging you subscription fees or adding more in-app purchases, making the internet much more expensive and reducing high-quality free content.”
This paragraph makes it clear that Facebook’s definition of “free” here is “free as in beer”, not “free as in speech”. That is, Apple’s change will not reduce the liberty of the internet. It will simply make it harder for sites to pay for their content-generation using targeted advertising.
Again, I think this argument doesn’t hold water, for the same reason given in the case of small businesses; unless the items being advertised are completely useless, shifting from targeted to untargeted advertising will simply level the advertising playing field, and make it harder for large companies to leverage their data science teams to separate you from your money.
However, a reduction in targeted advertising will make one huge difference; it will mean that small businesses will be more likely to work directly with the sites that their projected customers will use, rather than giving a huge slice of their money to middlemen like Facebook that mediate and control access to the targeted audiences. If I think that my customers read the Wall Street Journal, I will contact the Wall Street Journal and place an ad. This may sound like business as usual, but it’s absolutely terrifying to advertising middlemen whose current value is in holding all of the information about customers, and placing advertisements directly in the pages of those who are likely to click on them.
In Summary…
To summarize: tracking is still possible after this move; it’s just that users must opt into it, rather than having it on by default.
And here’s the thing. If you’re as terrified as this by the idea that users might have to explicitly consent to your practices… maybe you’re not actually the good guy.
Or, as That Mitchell and Webb Look put it: “Hans … are we the baddies?”