文件名称:双向链表 链表(C++编写)
文件大小:6KB
文件格式:RAR
更新时间:2014-01-10 07:38:32
链表 双向链表
Our doubly linked lists have two header elements: the "head" just before the first element and the "tail" just after the last element. The `prev' link of the front header is null, as is the `next' link of the back header. Their other two links point toward each other via the interior elements of the list. An empty list looks like this: +------+ +------+ <---| head |<--->| tail |---> +------+ +------+ A list with two elements in it looks like this: +------+ +-------+ +-------+ +------+ <---| head |<--->| 1 |<--->| 2 |<--->| tail |<---> +------+ +-------+ +-------+ +------+ The symmetry(对称) of this arrangement(布置) eliminates(消除) lots of special cases in list processing. For example, take a look at list_remove(): it takes only two pointer assignments and no conditionals. That's a lot simpler than the code would be without header elements. (Because only one of the pointers in each header element is used, we could in fact combine them into a single header element without sacrificing(牺牲) this simplicity. But using two separate elements allows us to do a little bit of checking on some operations, which can be valuable.) */
【文件预览】:
双向链表
----双向链表.ncb(41KB)
----Debug()
----双向链表.opt(53KB)
----双向链表.dsp(4KB)
----双向链表.dsw(541B)