Week 124 of 145 ยท TAOCP Vol 4A: Combinatorial Algorithms, Part 1

TAOCP 7.1.3 Bitwise Tricks and Techniques (part 2)

1 task, 3 steps. Open a task's steps to see exactly what to do; each guide has the detail.

Sign up or sign in to tick these off and give this week a due date.

By the end of this week you can

  • Use bit vectors to compute reachability in a digraph.
  • Implement branch-free minimum and maximum with masks.
  • Explain how binary labels find nearest common ancestors in a tree.

Week 124 ยท Self-check

Three quick questions

Ungraded, and it never holds anything up. Pick an answer to see why.

  1. You keep each vertex's reachable set as a bit vector. When v has an arc to w, how do you update R[v]?
  2. With integers x and y, and (x < y) as 1 or 0, which expression gives min(x, y) without a branch?
  3. A complete binary tree numbers the root 1 and the children of k as 2k and 2k + 1. What is the nearest common ancestor of 12 and 14?

Nothing is saved while signed out.

Watch along

Free talks and lectures that go with this week, on the speakers' own channels. Optional.

Discussion

0 posts

Stuck on week 124, or finished early? Say what you tried and what happened. Hints over answers: full solutions go in a spoiler.

No posts yet. Ask a question or share a tip.

Sign in to postAnyone can read. Posting needs an account with a confirmed email.

Spot a mistake? Report it