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

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.

主站蜘蛛池模板: 临潭县| 桑植县| 岐山县| 盐城市| 明溪县| 内丘县| 集安市| 文水县| 同仁县| 山阳县| 沙田区| 临潭县| 大关县| 噶尔县| 仁寿县| 宜黄县| 上犹县| 乌拉特前旗| 彩票| 平果县| 墨竹工卡县| 铁力市| 成武县| 华容县| 义马市| 特克斯县| 贵溪市| 南溪县| 奎屯市| 四子王旗| 信宜市| 自治县| 米易县| 临澧县| 广元市| 金阳县| 绵阳市| 婺源县| 永顺县| 军事| 冀州市|