TAOCP Vol 1: Fundamental Algorithms · Week 49

TAOCP 2.1 Introduction

Updated

About 3 hours9 exercises, rated 04 to 23

Summary

TAOCP 2.1 Introduction: Chapter 2 opens by defining how Knuth represents data in memory: nodes made of fields, links (pointers), and the notation he uses for them. Budget about 3 hours; do exercises 1, 2 and 3.

It walks through a small example with a pile of playing cards.

Flashcards 13 cards for Anki and AnkiMobile · all decks

Anki deck.tsv

This week's steps

3 steps
  1. Read §2.1 Introduction

    Short and important.

  2. Work the exercises (7 picked)

    Start with Ex 1, Ex 2, Ex 3; log what you solve below.

  3. Write down one thing you'd explain to someone

    A few sentences in your own words in Your notes: the idea, why it works, an example. 30 words ticks this.

Sign in to track this: tick each step off and it counts toward your week.

Exercises

This section has 9 exercises, rated 04 to 23, and Knuth marks one of them with the triangle for recommended. A light set. Do the low ones in your head and write one of the MIX programs (8 or 9).

Worth your time

  • Exercise 104

    Follow links in the card-pile example to read off field values.

    Discuss

  • Exercise 210

    Work out when taking an address and then dereferencing gets you back where you started.

    Discuss

  • Exercise 311

    Pop the top card. The inverse of the text's push.

    Discuss

  • Exercise 418

    Insert a card at the bottom of the pile, empty pile included.

    Discuss

  • Exercise 521▶ Recommended

    Remove the bottom card, which means walking to the node before it.

    Discuss

  • Exercise 818

    Turn one of the text's card-pile algorithms into MIX.

    Discuss

  • Exercise 923

    Print the pile from MIX, one card per line, with face-down cards marked.

    Discuss

Your log

Sign in to log the exercises you work: number, rating, how far you got.

Your notes

Only you

Sign in to keep private notes on this guide, in Markdown. They stay yours: never on your profile, and you can export them all.

Discussion

0 posts

Questions about the reading go here; each exercise has its own thread below. Hints over answers.

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

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

Exercise threads

One thread per exercise. Open one to ask for a nudge or check your thinking.

  • Exercise 104No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 210No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 311No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 418No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 521No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 818No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

  • Exercise 923No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

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

Reference

Why it matters

This notation is used for the rest of the series. It also forces you to think about data as concrete memory layout, which is exactly what C taught you in clox.

Before you start
  • 1.3 MIX
How to approach it

Short and important. Learn the node and field notation until you can read it without thinking. Relate it to C structs and pointers.

Common traps
  • Mixing up a link and the node it points to in Knuth's notation.

Spot a mistake? Report it

Back to week 49