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

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.

主站蜘蛛池模板: 浏阳市| 江口县| 福贡县| 三门县| 镇远县| 中西区| 藁城市| 新河县| 灵寿县| 苏尼特左旗| 石屏县| 鹤庆县| 那坡县| 新宁县| 揭阳市| 青川县| 新宁县| 新郑市| 璧山县| 霍州市| 卢龙县| 谢通门县| 镇沅| 雷山县| 平湖市| 股票| 贺兰县| 固始县| 山阳县| 大英县| 苏州市| 巴林左旗| 博湖县| 蚌埠市| 德钦县| 宜都市| 融水| 岳池县| 郴州市| 固阳县| 汪清县|