Local Optima Under Closed Conditions

I have indeed seen a C tutorial on red-black trees written by a Peking University undergraduate, though not a computer science student, but one in bioengineering. Some parts had the beauty of reinvented invention. For example, the so-called “array-based red-black tree” already has a specific name: a cursor-based implementation, as opposed to a pointer-based one. The standard approach is also to abstract allocation and access, rather than hard-code and rewrite the algorithmic logic.

The standard practice in modern C++ is precisely to use templates to decouple algorithmic logic from the underlying storage and access method. The STL itself is a product of this idea. Containers handle memory management, iterators handle access abstraction, and algorithms interact only with iterators; they do not care at all whether the underlying representation is a pointer-linked list allocated on the heap, cursor indices in an array pool, or offsets inside a memory-mapped file. In the specific case of red-black trees, if you want a cursor-based implementation, the modern approach is to make the node reference type a template parameter, or to abstract it through a traits or policy class. For instance, a NodeTraits can define whether reference_type is a pointer or an array index, and define the concrete implementations of get_left(), get_right(), and get_parent(). Then the rotation, insertion, and deletion logic of the red-black tree can be written entirely against those abstract interfaces, without changing a single line of the algorithm. This is policy-based design, the line of thought Alexandrescu systematically elaborated in Modern C++ Design.

Watching someone derive a known conclusion from zero by relying only on their own intelligence can be intellectually beautiful. The derivation itself has real force of thought. But that beauty also carries a trace of sadness, because at bottom it is a failure of information acquisition efficiency. If he had read Sedgewick’s Algorithms, or any textbook that covers cursor-based implementations, he could have learned in ten minutes what this thing is called and what the standard approach is, then invested his intelligence in genuinely unsolved problems.

So later, when I looked at the gaokao, I felt the same way I did when reading that Peking University student’s red-black tree tutorial. Do you say the level is not high? He really did manage to think of it. Do you say the level is high? In terms of actual effect, not necessarily. The gaokao and that student’s red-black tree tutorial are, at the bottom, the same paradox: high-intensity intellectual performance under closed conditions.

The final problem in gaokao mathematics is a typical example. The problem setter operates inside an extremely constrained knowledge range, namely the high school mathematics syllabus, and designs a problem requiring very high levels of technique. The examinees, too, develop exquisitely refined problem-solving strategies inside this closed space. Do you say these people are not smart? The solutions are indeed clever, and the density of thought is high. Do you say these people are advanced? The techniques they spent three years studying in depth often look, from the perspective of university mathematics, like trivial special cases of known theorems. For example, those suffocating inequality-bounding tricks in gaokao problems are essentially attempts to do what calculus should do while calculus is forbidden. From one angle, this is astonishing: you can still box with one hand tied. But from the perspective of efficiency, why not untie the hand?

This is the essence of “not very advanced, but able to think of it”: a local optimum developed under artificially manufactured constraints. The information environment determines the output efficiency of intelligence. A closed system can select for the strong under closed conditions, but the definition of “strong” is itself distorted by those closed conditions. The gaokao selects for “the person best at mathematical gymnastics under the premise that advanced tools are forbidden”; Zhihu selects for “the person best at writing within constraints”; that student demonstrates “the person best at independent derivation under information isolation.” Each is a real ability, but each is also being wasted by the constraints. The same intelligence, in an information-rich environment, can stand on the shoulders of giants and push forward; in an information-poor environment, it can only spend enormous effort repaving roads that others have already paved.

So a person’s level, in fact, depends less on how hard they work than on the information environment they inhabit. For instance, many people’s circles never really come into contact with things like land finance, vertical and horizontal bureaucratic fragmentation, or foreign-exchange facilitation quotas; they also cannot understand what a tax base or liquidity is. Many technical people think the only meaningful difference is the network environment, and this is a form of ignorance: they have no assets to allocate, no enterprise to operate, and you cannot price what lies outside your cognition. So many people can only say “iron rice bowl” and “stability,” while there is a more accurate term they do not know how to use: endorsement by state credit.