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

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.

主站蜘蛛池模板: 锡林浩特市| 白河县| 永年县| 富源县| 彭州市| 班玛县| 武宣县| 德安县| 营口市| 惠水县| 宜丰县| 朝阳市| 日土县| 兴业县| 樟树市| 花莲市| 黄骅市| 新竹市| 中方县| 玛纳斯县| 六盘水市| 饶阳县| 平度市| 铜梁县| 桃园县| 和平区| 遂昌县| 宁波市| 阳东县| 通江县| 彩票| 呼伦贝尔市| 辉南县| 苏尼特左旗| 新龙县| 定结县| 浏阳市| 秭归县| 阳泉市| 阿图什市| 云阳县|