官术网_书友最值得收藏!

Pointer structures

Contrary to arrays, pointer structures are lists of items that can be spread out in memory. This is because each item contains one or more links to other items in the structure. What type of links these are dependent on the type of structure we have. If we are dealing with linked lists, then we will have links to the next (and possibly previous) items in the structure. In the case of a tree, we have parent-child links as well as sibling links. In a tile-based game where the game map is built up of hexes, each node will have links to up to six adjacent map cells.

There are several benefits with pointer structures. First of all, they don't require sequential storage space. Second, they can start small and grow arbitrarily as you add more nodes to the structure.

As noted in Chapter 2, Python Data Types and Structures, however, this comes at a cost. If you have a list of integers, each node is going to take up the space of an integer, as well as an additional integer for storing the pointer to the next node.

主站蜘蛛池模板: 郁南县| 丰顺县| 淮北市| 怀仁县| 柏乡县| 调兵山市| 井冈山市| 瑞金市| 枣庄市| 疏勒县| 扎鲁特旗| 普洱| 麟游县| 富锦市| 桑植县| 九龙坡区| 郎溪县| 濉溪县| 陆丰市| 西畴县| 陆川县| 安国市| 宁晋县| 武城县| 凤城市| 卢湾区| 合江县| 潮州市| 通河县| 集贤县| 滦平县| 民县| 巴楚县| 临猗县| 贺州市| 玉门市| 怀安县| 黑龙江省| 莱西市| 同江市| 巨野县|