皮肤过敏用什么药膏| 总是放屁什么原因| 月经前几天是什么期| 异位性皮炎是什么意思| 菊花茶有什么功效| tpo是什么意思| 12月23日是什么星座| 什么病| 什么秒必争| oioi是什么牌子| 天蝎和什么星座最配| cream什么意思| 妊娠高血压什么症状| 吃什么变聪明| 复刻什么意思| 腰两边疼是什么原因| 数字9像什么| 阴超是什么| 双重人格是什么意思| 脚水肿是什么原因引起的| 去除扁平疣用什么药膏| 固执什么意思| nos是什么单位| 智齿一般长在什么位置| 什么动物| 心血管病人吃什么最好| 周杰伦有什么病| 吃什么长骨头最快| 稷是什么作物| ;是什么号| 菠萝蜜不能跟什么一起吃| 706代血浆又叫什么| 子五行属什么| 6月30日是什么节日| 牛肉配什么菜包饺子好吃| 三叉神经痛吃什么药| 1972年出生属什么生肖| 尿蛋白高不能吃什么食物| 深海鱼油有什么作用| 成双成对是什么生肖| 水镜先生和司马懿是什么关系| 丁香泡水喝有什么功效和作用| 经常恶心干呕是什么原因| 病毒性肝炎有什么症状| 白细胞高是什么原因造成的| 宫颈非典型鳞状细胞是什么意思| 喝什么茶养肝护肝| 护士节送什么鲜花| 猫怕什么声音| 反黑是什么意思| 二垒是什么意思| 什么人容易得间质瘤| 女人脸色发黄吃什么补得最快| 孕妇什么时候做nt| 血氧饱和度是什么意思| 胎发什么时候剃最合适| 十一月七号是什么星座| 8月25号是什么日子| 口力念什么| 什么的油菜花| 脂蛋白是什么| 小孩子走神是什么原因| 全价猫粮是什么意思| 梦到吃肉是什么意思周公解梦| 兔肉和什么相克| 为什么油耳朵就有狐臭| pm是什么| 引产和流产有什么区别| 藏红花有什么作用和功效| 上火什么症状| 尿发黄是什么原因男性| 吃了羊肉不能吃什么| 记忆力减退吃什么药效果好| 11月份是什么星座| 懵是什么意思| 免疫缺陷是什么意思| 苹果是什么意思| 皮肤有白点是什么原因| 危如累卵是什么意思| 夏至有什么习俗| 发情什么意思| 精液发黄是什么原因引起的| 山竹什么味道| 言字旁与什么有关| 微信为什么不能转账| 9月19日是什么星座| 备孕吃什么最容易怀孕| 老子是什么朝代的人| 嫂嫂是什么意思| 类风湿因子高是什么原因| 顶臀径是指什么| 牙齿深覆合是什么意思| 大便粘稠是什么原因| 一垒二垒三垒全垒打是什么意思| 太古里是什么意思| 2月2日什么星座| 易拉罐是什么垃圾| 淋巴细胞偏低是什么意思| 木变石是什么| courvoisier是什么酒| 推迟月经用什么药| 心肌酶是查什么的| 尿是绿色的是什么原因| 宫颈肥大有什么症状| 自锁是什么意思| cj是什么意思| 叫嚣是什么意思| 4月29号0点是什么时候| 右小腿抽筋是什么原因| 蛇头是什么意思| 荷花代表什么生肖| 白细胞阴性什么意思| 什么情况需要打狂犬疫苗| 小孩脚底脱皮是什么原因造成的| 切克闹是什么意思| 11月30号是什么星座| 偏头痛有什么症状| 不显怀的人有什么特点| 女性感染hpv有什么症状| 200年属什么生肖| 眼睛酸疼是什么原因| 天公作美是什么生肖| lover是什么意思| 吃什么化痰效果最好最快| 人肉什么味道| 腹泻不能吃什么食物| dw是什么牌子的手表| 50年婚姻是什么婚| 多才多艺是什么生肖| 心衰用什么药| 腈纶是什么面料优缺点| 八点是什么时辰| 霉菌性阴道炎是什么| 什么血糖仪准确度高| 29度穿什么衣服合适| 5月3日什么星座| 单绒双羊是什么意思| 眼屎多用什么眼药水好| 肠胃炎饮食要注意什么| 什么是月食| 男人得了hpv有什么症状| 办身份证要带什么| 茭头是什么| 谛听是什么意思| 小腹痛男性什么原因| 什么原因会导致月经推迟| 甲减对胎儿有什么影响| 为什么说成也萧何败也萧何| 黄色配什么颜色最搭| 什么品牌的母婴用品好| 瞬息什么| 甲状腺属于什么系统| 脚痛什么原因引起的| 人为什么会抑郁| 长白头发了吃什么才能把头发变黑| 私事是什么意思| 狐臭是什么味道| 量贩什么意思| 手串14颗代表什么意思| 关羽使用的武器是什么| 看抑郁症挂什么科| 足跟痛用什么药| 什么的麦田| 鼻炎吃什么药见效快| 什么叫伴手礼| 甘油三酯高吃什么食物降得快| 血氧饱和度什么意思| 肾阴虚是什么症状| 尿检蛋白质弱阳性是什么意思| 砸是什么意思| 澄字五行属什么| 经常干咳嗽是什么原因| 虎虎生风是什么意思| 23数字代表什么意思| 合肥有什么特产| 宝珀手表属于什么档次| 踢皮球是什么意思| 为什么今年闰六月| 五行代表什么| 西施是什么生肖| 迁移是什么意思| 插入阴道什么感觉| 尿检潜血是什么意思| 猫发出咕噜咕噜的声音是什么意思| 拉拉秧学名叫什么| 李约瑟难题是什么| 鹿角菜是什么植物| 全身燥热是什么原因引起的| 网球肘是什么症状| 攻击是什么意思| 脂蛋白是什么意思| 送哥们什么礼物好| 熊猫血是什么血型| 甘油三酯高是什么原因造成的| 虾子不能和什么一起吃| 喉咙痛有痰吃什么药| 银梳子梳头有什么好处| 木糖醇是什么东西| 脸上起红疙瘩是什么原因| 感冒为什么不能吃鸡蛋| 72年鼠是什么命| 柯基犬为什么要断尾巴| 阴道口瘙痒是什么原因| 3人死亡属于什么事故| 鲁迅的原名叫什么| 2月23是什么星座| 85年属什么的生肖| 尿黄是什么原因男性| 三轮体空什么意思| 共建是什么意思| 石膏的主要成分是什么| 57年属什么生肖| 躺尸是什么意思| 吃什么长内膜最快最有效| 什么药可以治早迣| 肉毒为什么怕热敷| 什么是天葬| 孔夫子搬家的歇后语是什么| 亚洲没有什么气候| 内膜增生是什么意思| 灭吐灵又叫什么名字| 裂纹舌是什么原因引起的| 经常耳鸣是什么原因| 一流是什么意思| wifi用户名是什么| 肚子疼喝什么药| 潴留是什么意思| 前列腺钙化灶是什么病| 绞股蓝有什么作用| 散片是什么意思| 看牙挂什么科| 胃气上逆有什么好的办法治疗| 解惑是什么意思| 木石念什么| 毛囊炎是什么症状| 受凉咳嗽吃什么药| 贡缎是什么面料| 打马虎眼是什么意思| 月牙代表什么意思| 微博id是什么| oh什么意思| 痢疾吃什么药效果最好| 检查乳腺挂什么科| 不孕不育应检查什么| 骰子是什么意思| 什么东西化痰效果最好最快| 自由行是什么意思| 舞象之年是什么意思| 这个人就是娘是什么歌| 一对什么| 大腿肌肉酸痛是什么病| 肺部肿瘤不能吃什么| 梦见蛇被别人打死是什么兆头| 化疗期间吃什么水果好| 米老鼠叫什么名字| 舌头起泡什么原因| 大暑是什么意思啊| 1929年属什么| 精液长什么样| 碟鱼头是什么鱼| 产后第一天吃什么最好| 996是什么| 乳头瘤病毒是什么意思| 为什么穿堂风最伤人| 百度Jump to content

用车目睹一起交通事故的处理 按“让右”原则

From Wikipedia, the free encyclopedia
百度 会议作出关于执行请示报告制度的决议,要求各级党组织增强纪律性。

In computer science, a list or sequence is a collection of items that are finite in number and in a particular order. An instance of a list is a computer representation of the mathematical concept of a tuple or finite sequence.

A list may contain the same value more than once, and each occurrence is considered a distinct item.

A singly-linked list structure, implementing a list with three integer elements.

The term list is also used for several concrete data structures that can be used to implement abstract lists, especially linked lists and arrays. In some contexts, such as in Lisp programming, the term list may refer specifically to a linked list rather than an array. In class-based programming, lists are usually provided as instances of subclasses of a generic "list" class, and traversed via separate iterators.

Many programming languages provide support for list data types, and have special syntax and semantics for lists and list operations. A list can often be constructed by writing the items in sequence, separated by commas, semicolons, and/or spaces, within a pair of delimiters such as parentheses '()', brackets '[]', braces '{}', or angle brackets '<>'. Some languages may allow list types to be indexed or sliced like array types, in which case the data type is more accurately described as an array.

In type theory and functional programming, abstract lists are usually defined inductively by two operations: nil that yields the empty list, and cons, which adds an item at the beginning of a list.[1]

A stream is the potentially infinite analog of a list.[2]:?§3.5?

Operations

[edit]

Implementation of the list data structure may provide some of the following operations:

  • create
  • test for empty
  • add item to beginning or end
  • access the first or last item
  • access an item by index

Implementations

[edit]

Lists are typically implemented either as linked lists (either singly or doubly linked) or as arrays, usually variable length or dynamic arrays.

The standard way of implementing lists, originating with the programming language Lisp, is to have each element of the list contain both its value and a pointer indicating the location of the next element in the list. This results in either a linked list or a tree, depending on whether the list has nested sublists. Some older Lisp implementations (such as the Lisp implementation of the Symbolics 3600) also supported "compressed lists" (using CDR coding) which had a special internal representation (invisible to the user). Lists can be manipulated using iteration or recursion. The former is often preferred in imperative programming languages, while the latter is the norm in functional languages.

Lists can be implemented as self-balancing binary search trees holding index-value pairs, providing equal-time access to any element (e.g. all residing in the fringe, and internal nodes storing the right-most child's index, used to guide the search), taking the time logarithmic in the list's size, but as long as it doesn't change much will provide the illusion of random access and enable swap, prefix and append operations in logarithmic time as well.[3]

Programming language support

[edit]

Some languages do not offer a list data structure, but offer the use of associative arrays or some kind of table to emulate lists. For example, Lua provides tables. Although Lua stores lists that have numerical indices as arrays internally, they still appear as dictionaries.[4]

In Lisp, lists are the fundamental data type and can represent both program code and data. In most dialects, the list of the first three prime numbers could be written as (list 2 3 5). In several dialects of Lisp, including Scheme, a list is a collection of pairs, consisting of a value and a pointer to the next pair (or null value), making a singly linked list.[5]

Applications

[edit]

Unlike in an array, a list can expand and shrink.

In computing, lists are easier to implement than sets. A finite set in the mathematical sense can be realized as a list with additional restrictions; that is, duplicate elements are disallowed and order is irrelevant. Sorting the list speeds up determining if a given item is already in the set, but in order to ensure the order, it requires more time to add new entry to the list. In efficient implementations, however, sets are implemented using self-balancing binary search trees or hash tables, rather than a list.

Lists also form the basis for other abstract data types including the queue, the stack, and their variations.

Abstract definition

[edit]

The abstract list type L with elements of some type E (a monomorphic list) is defined by the following functions:

nil: () → L
cons: E × LL
first: LE
rest: LL

with the axioms

first (cons (e, l)) = e
rest (cons (e, l)) = l

for any element e and any list l. It is implicit that

cons (e, l) ≠ l
cons (e, l) ≠ e
cons (e1, l1) = cons (e2, l2) if e1 = e2 and l1 = l2

Note that first (nil ()) and rest (nil ()) are not defined.

These axioms are equivalent to those of the abstract stack data type.

In type theory, the above definition is more simply regarded as an inductive type defined in terms of constructors: nil and cons. In algebraic terms, this can be represented as the transformation 1 + E × LL. first and rest are then obtained by pattern matching on the cons constructor and separately handling the nil case.

The list monad

[edit]

The list type forms a monad with the following functions (using E* rather than L to represent monomorphic lists with elements of type E):

where append is defined as:

Alternatively, the monad may be defined in terms of operations return, fmap and join, with:

Note that fmap, join, append and bind are well-defined, since they're applied to progressively deeper arguments at each recursive call.

The list type is an additive monad, with nil as the monadic zero and append as monadic sum.

Lists form a monoid under the append operation. The identity element of the monoid is the empty list, nil. In fact, this is the free monoid over the set of list elements.

See also

[edit]
  • Array data type – Data type that represents an ordered collection of elements (values or variables)
  • Queue – Abstract data type
  • Set – Abstract data type for storing unique values
  • Stack – Abstract data type
  • Stream – Sequence of data items available over time

References

[edit]
  1. ^ Reingold, Edward; Nievergelt, Jurg; Narsingh, Deo (1977). Combinatorial Algorithms: Theory and Practice. Englewood Cliffs, New Jersey: Prentice Hall. pp. 38–41. ISBN 0-13-152447-X.
  2. ^ Abelson, Harold; Sussman, Gerald Jay (1996). Structure and Interpretation of Computer Programs. MIT Press.
  3. ^ Barnett, Granville; Del tonga, Luca (2008). "Data Structures and Algorithms" (PDF). mta.ca. Retrieved 12 November 2014.
  4. ^ Lerusalimschy, Roberto (December 2003). Programming in Lua (first edition) (First ed.). Lua.org. ISBN 8590379817. Retrieved 12 November 2014.
  5. ^ Steele, Guy (1990). Common Lisp (Second ed.). Digital Press. pp. 29–31. ISBN 1-55558-041-6.
羊冲什么生肖 为什么会起水泡 一路卷风迎大年是什么生肖 胆摘除对身体有什么影响 哥斯拉是什么动物
身体缺钾是什么原因造成的 欲盖弥彰是什么意思 湿热内蕴吃什么中成药 淋巴细胞高是什么原因 生肖鼠和什么生肖相冲
本科是什么意思 女人带貔貅有什么讲究 kap是什么意思 肾小球滤过率是什么意思 为什么会打呼
三摩地是什么意思 mhc是什么意思 阶段是什么意思 南辕北辙是什么意思 每天放很多屁是什么原因
梦到捉鱼是什么意思hcv9jop4ns0r.cn 橘子什么时候成熟hcv9jop2ns3r.cn 腺病毒是什么病毒hcv9jop6ns6r.cn 什么是药食同源hcv9jop0ns4r.cn 金字旁的字和什么有关hcv8jop6ns7r.cn
痞是什么意思hcv8jop7ns1r.cn 白虎女是什么意思hcv9jop3ns7r.cn 小孩脸肿是什么原因引起的hcv8jop4ns0r.cn 店铺开业送什么礼物好hcv9jop4ns1r.cn 张靓颖什么星座hcv8jop5ns9r.cn
孩子呼吸道感染吃什么药效果最好hcv8jop4ns3r.cn 经颅多普勒检查什么hcv8jop9ns1r.cn 臀位是什么意思hcv8jop4ns3r.cn 什么的大圆盘hcv8jop5ns1r.cn 梦见财神爷是什么预兆hcv8jop9ns9r.cn
为什么开空调没蚊子qingzhougame.com 在所不辞是什么意思fenrenren.com 反流性食管炎可以吃什么水果hcv8jop1ns8r.cn 唾液分泌过多是什么原因luyiluode.com 银行卡销户是什么意思hcv8jop4ns6r.cn
百度