#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::2.2.1 Stacks, Queues, and Deques
#columns:Front	Back	Tags
TAOCP §2.2.1 Stacks, Queues, and Deques: what does it cover?	The three classic linear structures defined by where you insert and delete. Knuth uses railway-switching pictures to explore which output orders a stack or deque can produce from a given input order.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::about
TAOCP §2.2.1: why does it matter?	Stacks and queues are the backbone of parsers, schedulers and graph search. The question of which permutations a stack can produce is a classic interview-style puzzle with a beautiful answer.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::why
TAOCP §2.2.1: what traps should you watch for?	<ul><li>Confusing an input-restricted deque with an output-restricted one.</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::traps
TAOCP §2.2.1, exercise 1 (rated 06): what is it asking?	Check what input- and output-restricted deques can each imitate.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 2 (rated 15, recommended): what is it asking?	Push railroad cars through a stack by hand and see which orders you can make.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 3 (rated 25): what is it asking?	Characterize the push and pop strings a stack can actually carry out.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 6 (rated 00): what is it asking?	What a queue can do to the order. A sanity check.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 7 (rated 25, recommended): what is it asking?	Find permutations that separate the two kinds of restricted deque.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 14 (rated 26, recommended): what is it asking?	Build an efficient queue out of two stacks. The interview classic, from the source.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1, exercise 5 (rated M28, recommended): what is it asking?	Prove the forbidden-pattern test for which permutations a stack can produce. The stretch.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercise
TAOCP §2.2.1: how many exercises, and how are they rated?	14 exercises, rated 00 to M48.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::exercises
TAOCP §2.2.1: what should you be comfortable with first?	<ul><li>2.1 Introduction</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::prereqs
TAOCP §2.2.1: how should you work through it?	Draw the railway diagrams and push cars through them by hand. Then write a quick program that lists all permutations of 1..4 a stack can produce and count them. Compare with the Catalan numbers.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.2.1 cracked.guide::kind::approach
