Static head nodes in the operation on dynamic structures: a useful programming technique
暂无分享,去创建一个
In operations on dynamic data structures (e.g., linked list), manipulating the first node should often be treated specially. Head nodes are used to deal with this problem. Unfortunately, the unused head-nodes are appendices too. They make other trouble in using the structures. In this paper, we use a number of examples to illustrate a technique to handle the problem: using static, temporary head nodes in operations on dynamic data structures. With this technique, definitions of operations on dynamic data structures may become simpler and clearer.
[1] Bjarne Stroustrup,et al. C++ Programming Language , 1986, IEEE Softw..
[2] Donald E. Knuth,et al. The Art of Computer Programming, Volume I: Fundamental Algorithms, 2nd Edition , 1997 .