什么玻璃| 雪松香是什么味道| MS医学上是什么意思| 乌岽单丛是什么茶| 血珀五行属什么| 炒菜用什么锅好| 空调综合征有什么症状| 乌鸡炖什么好吃| 突然膝盖疼是什么原因| 鸡涌是什么意思| 花生不能和什么一起吃| 未时左眼跳是什么预兆| 兵部尚书相当于现在的什么官| 感染四项挂什么科| 叶酸买什么牌子的好| 多饮多尿可能是什么病| 琥珀是什么颜色| 反酸是什么感觉| 外婆的弟弟叫什么| 怀孕生化了是什么原因| 含金量什么意思| 上海副市长什么级别| 世界上最贵的烟是什么烟| 姓杨的女孩子取什么名字| 月经提前半个月来是什么原因| 精索静脉曲张是什么| 拥趸是什么意思| 心脑血管供血不足吃什么药| 血压高是什么症状| 安乃近是什么药| 高定是什么意思| 南非用什么货币| 智齿什么时候开始长| 甲钴胺有什么副作用| 吃什么瘦肚子| 一什么浮萍| 垂体瘤挂什么科| 四面楚歌是什么意思| 什么的教室填空| 吃饭的时候恶心想吐是什么原因| 吃什么食物可以减肥| 七月三号什么星座| 手上月牙代表什么| 肝岛是什么意思| 消谷善饥是什么意思| 手指甲紫色是什么原因| 手上长痣代表什么| 什么水果糖分最高| 一什么牛奶| 吃维生素b有什么好处| 为什么会有肥胖纹| 老年斑用什么药膏可以去掉| 眼干眼涩眼疲劳用什么眼药水| 1966年属马的是什么命| 寻麻疹不能吃什么| 治疗阴虱子用什么药最好| 女予念什么| 伏特加兑什么饮料好喝| 甲亢在中医里叫什么病| 电压不稳定是什么原因| 法令纹深代表什么面相| wonderflower是什么牌子| 流产什么样的症状表现| 早搏是什么原因引起的| 果是什么结构的字| 乌龟肠胃炎用什么药| 牛油果不能和什么一起吃| 为什么拉的屎是墨绿色| 什么是叶黄素| 右手大拇指发麻是什么原因| 肿瘤患者不能吃什么| 宸字五行属什么| 黑长直是什么意思| 总是爱出汗是什么原因| 中国人为什么要学英语| barbie是什么意思| 猫咪掉胡子是什么原因| 疖肿什么意思| 渡人渡己什么意思| 贫血什么意思| 吃什么提高记忆力| 腰扭伤挂什么科| 人大代表是什么| 黄疸是什么原因引起的| 宝宝不长肉是什么原因| 为什么会起荨麻疹| 薄熙来犯了什么罪| 烤冷面是什么材料做的| 黄粉虫吃什么| 蓝色配什么颜色最好看| 肠梗阻什么症状| 武则天什么朝代| fs是什么意思| 为什么会突然得荨麻疹| 无花果什么味道| 什么是瑜伽| 闭经是什么意思| 什么影院| cpi什么意思| 起灵是什么意思| 女人脖子后面有痣代表什么| 浮屠是什么意思| 你为什么爱我| 胆结石吃什么| 鸟语花香是什么生肖| 兔死狗烹是什么生肖| 肺部真菌感染用什么药最好| 吃什么去黄气美白| 吃桃子对身体有什么好处| 奄奄一息的息是什么意思| 香干是什么| 姜还是老的辣是什么意思| 红枣泡水喝有什么好处| aids是什么病的简称| 淀粉酶偏高是什么原因| 太平洋中间是什么| 潜行是什么意思| 海蜇丝是什么做的| 肝部出现腹水是什么原因| 殇什么意思| 水压低用什么花洒| 什么的搏斗| 胃疼和肚子疼有什么区别| 合加羽念什么| 什么是假性自闭症| 头痛反胃想吐什么原因| 干你什么事| 破釜沉舟的釜是什么意思| 维生素b不能和什么一起吃| 毫无违和感什么意思| 青蛙喜欢吃什么| 男人为什么累| 波澜壮阔是什么意思| 腮腺炎看什么科室| 左心室肥大是什么意思| 斛是什么意思| 中性粒细胞数目偏高是什么意思| 交叉感染是什么意思| 丝光棉是什么面料| 自白是什么意思| 打喷嚏很臭是什么原因| 疳积有什么症状| IQ是什么| 天蝎座的幸运色是什么| 维生素b族什么牌子的好| 种植什么最赚钱农村| 九月底是什么星座| 肌无力是什么病| 合成革是什么材质| 楼房风水主要看什么| herry是什么意思| 考试前吃什么能让大脑发挥最佳| 夏天适合吃什么食物| 什么样的梦才算是胎梦| 手术室为什么在三楼| 孙字五行属什么| 尿微肌酐比值高是什么情况| bhpc是什么牌子| 疣是一种什么病| 身体内热是什么原因| 人为什么会咳嗽| 全麦粉和小麦粉的区别是什么| 8月6号什么星座| 得水痘不能吃什么| 什么天揽月| 中国一词最早出现在什么时候| 哺乳期吃什么水果好| 有所作为的意思是什么| 三高人群适合吃什么| 为什么打死不吃骡子肉| 颈椎痛看什么科| 咳嗽吃什么| 梦见参加葬礼是什么意思| 证悟是什么意思| 植物人是什么| 一什么山泉| 梦见把头发剪短了是什么意思| 办理生育登记有什么用| 汗斑用什么药擦最有效| 吃了羊肉不能吃什么| 什么汤好喝又简单| 加湿器用什么水| cmv是什么病毒| 晚上七点到九点是什么时辰| 总是心慌是什么原因| 上梁不正下梁歪是什么意思| 霍霍人什么意思| 医院测视力挂什么科| 肾结石吃什么水果好| 东北有什么好玩的景点| 门牙下面的牙叫什么| 高胆固醇吃什么药| 串联质谱筛查是什么病| 月经期喝什么好| 努尔哈赤是什么意思| 狍子是什么动物| 什么是心脏早搏| 豆奶不能和什么一起吃| ph值是什么意思| 扁平疣是什么引起的| 竹荪是什么| 被臭虫咬了擦什么药| 2002年属什么| 正骨有什么好处和坏处| 火影忍者大结局是什么| 打边炉是什么| 龟苓膏的原料是什么| 因加一笔是什么字| 唇色深是什么原因| 因材施教什么意思| 陆地上最大的动物是什么| 软禁是什么意思| 心肌炎查什么能查出来| 水瓶座女生和什么星座男生最配| 咳嗽有黄痰吃什么消炎药| 海带和什么不能一起吃| 五月份是什么星座| domyos是什么牌子| 狐狸是什么科| 遗精吃什么药| 茶色是什么颜色| 肱骨头小囊变什么意思| 胆囊结石是什么症状| 国家安全法属于什么法| 覆盆子是什么东西| 视觉感受器是什么| 水瓶是什么星座| 宫腔线分离是什么意思| 鞠婧祎什么学历| 脐炎用什么药| 青团是什么节日吃的| 1972年是什么年| 孕囊形态欠规则是什么意思| 月经来了痛经吃什么药| 肝内脂质沉积是什么意思| 香蕉补什么| 青岛有什么山| 什么是暗网| 印度属于什么人种| 肾不好挂什么科| s.m什么意思| 尿胆原normal是什么意思| 晚上睡觉多梦是什么原因| 君子菜是什么蔬菜| 为什么会有地震| 叶公好龙讽刺了什么| 深紫色配什么颜色好看| 什么是造影手术| 唐僧是什么佛| 红色加绿色等于什么颜色| 鲈鱼不能和什么一起吃| 肝胃郁热吃什么中成药| 吃得苦中苦方为人上人是什么意思| 读书是为了什么| 办护照照片有什么要求| 鹦鹉为什么会说话| 空洞是什么意思| 什么的雾霾| 天乙是什么意思| 62年属什么生肖| eb病毒抗体阳性是什么意思| 尿急是什么意思| 桂附地黄丸治什么病| 节操什么意思| 百度

清华大学将迁入雄安新区?校方:没相关的消息

百度 在1965年,身材娇小的奥黛丽·赫本委托LV的创始人亨利·路易威登为她定制一款更轻便小巧的旅行袋,方便随身携带,于是Speedy25便诞生了。

In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actions and conditions.[1][2] Although pseudocode shares features with regular programming languages, it is intended for human reading rather than machine control. Pseudocode typically omits details that are essential for machine implementation of the algorithm, meaning that pseudocode can only be verified by hand.[3] The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The reasons for using pseudocode are that it is easier for people to understand than conventional programming language code and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications to document algorithms and in planning of software and other algorithms.

No broad standard for pseudocode syntax exists, as a program in pseudocode is not an executable program; however, certain limited standards exist (such as for academic assessment). Pseudocode resembles skeleton programs, which can be compiled without errors. Flowcharts, drakon-charts and Unified Modelling Language (UML) charts can be thought of as a graphical alternative to pseudocode, but need more space on paper. Languages such as HAGGIS bridge the gap between pseudocode and code written in programming languages.

Application

edit

Pseudocode is commonly used in textbooks and scientific publications related to computer science and numerical computation to describe algorithms in a way that is accessible to programmers regardless of their familiarity with specific programming languages. Textbooks often include an introduction explaining the conventions in use, and the detail of pseudocode may sometimes approach that of formal programming languages.

Programmers frequently begin implementing an unfamiliar algorithm by drafting it in pseudocode, then translating it into a programming language while adapting it to fit the larger program. This top-down structuring approach often starts with a pseudocode sketch refined into executable code. Pseudocode is also used in standardization; for example, the MPEG standards rely on formal C-like pseudocode, these standards cannot be understood without grasping the details of the code.[4]

Syntax

edit

Pseudocode generally does not actually obey the syntax rules of any particular language; there is no systematic standard form. Some writers borrow style and syntax from control structures from some conventional programming language, although this is discouraged.[5][6] Some syntax sources include Fortran, Pascal, BASIC, C, C++, Java, Lisp, and ALGOL. Variable declarations are typically omitted. Function calls and blocks of code, such as code contained within a loop, are often replaced by a one-line natural language sentence.

Depending on the writer, pseudocode may therefore vary widely in style, from a near-exact imitation of a real programming language at one extreme, to a description approaching formatted prose at the other.

This flexibility brings both major advantages and drawbacks: on the positive side, no executable programming language "can beat the convenience of inventing new constructs as needed and letting the reader try to deduce their meaning from informal explanations", on the negative, "untested code is usually incorrect".[7]

An example of pseudocode (for the mathematical game fizz buzz)

Pascal style:

procedure fizzbuzz;
  for i := 1 to 100 do
    print_number := true;
    if i is divisible by 3 then begin
      print "Fizz";
      print_number := false;
    end;
    if i is divisible by 5 then begin
      print "Buzz";
      print_number := false;
    end;
    if print_number, print i;
    print a newline;
  end

C style:

fizzbuzz() {
  for (i = 1; i <= 100; i++) {
    print_number = true;
    if (i is divisible by 3) {
      print "Fizz";
      print_number = false;
    }
    if (i is divisible by 5) {
      print "Buzz";
      print_number = false;
    }
    if (print_number) print i;
    print a newline;
  }
}

Python style:

def fizzbuzz():
  for i in range(1,101): 
    print_number = true
    if i is divisible by 3: 
      print "Fizz"
      print_number = false
    if i is divisible by 5:
      print "Buzz"
      print_number = false
    if print_number: print i
    print a newline

Mathematical style pseudocode

edit

In numerical computation, pseudocode often consists of mathematical notation, typically from matrix and set theory, mixed with the control structures of a conventional programming language, and perhaps also natural language descriptions. This is a compact and often informal notation that can be understood by a wide range of mathematically trained people, and is frequently used as a way to describe mathematical algorithms. For example, the sum operator (capital-sigma notation) or the product operator (capital-pi notation) may represent a for-loop and a selection structure in one expression:

Return  

Normally non-ASCII typesetting is used for the mathematical equations, for example by means of markup languages, such as TeX or MathML, or proprietary formula editors.

Mathematical style pseudocode is sometimes referred to as pidgin code, for example pidgin ALGOL (the origin of the concept), pidgin Fortran, pidgin BASIC, pidgin Pascal, pidgin C, and pidgin Lisp.

Common mathematical symbols

edit
Type of operation Symbol Example
Assignment ← or := c ← 2πr, c := 2πr
Comparison =, ≠, <, >, ≤, ≥
Arithmetic +, ?, ×, /, mod
Floor/ceiling ?, ?, ?, ? a ← ?b? + ?c?
Logical and, or
Sums, products Σ Π h ← ΣaA 1/a

Example

edit

The following is a longer example of mathematical-style pseudocode, for the Ford–Fulkerson algorithm:

algorithm ford-fulkerson is
    input: Graph G with flow capacity c, 
           source node s, 
           sink node t
    output: Flow f such that f is maximal from s to t

    (Note that f(u,v) is the flow from node u to node v, and c(u,v) is the flow capacity from node u to node v)

    for each edge (u, v) in GE do
        f(u, v) ← 0
        f(v, u) ← 0

    while there exists a path p from s to t in the residual network Gf do
        let cf be the flow capacity of the residual network Gf
        cf(p) ← min{cf(u, v) | (u, v) in p}
        for each edge (u, v) in p do
            f(u, v)f(u, v) + cf(p)
            f(v, u) ← ?f(u, v)

    return f

Machine compilation of pseudocode style languages

edit

Natural language grammar in programming languages

edit

Several attempts to bring elements of natural language grammar into computer programming have produced programming languages such as HyperTalk, Lingo, AppleScript, SQL, Inform, and to some extent Python. In these languages, parentheses and other special characters are replaced by prepositions, resulting in quite verbose code. These languages are typically dynamically typed, meaning that variable declarations and other boilerplate code can be omitted. Such languages may make it easier for a person without knowledge about the language to understand the code and perhaps also to learn the language. However, the similarity to natural language is usually more cosmetic than genuine. The syntax rules may be just as strict and formal as in conventional programming, and do not necessarily make development of the programs easier.

Mathematical programming languages

edit

An alternative to using mathematical pseudocode (involving set theory notation or matrix operations) for documentation of algorithms is to use a formal mathematical programming language that is a mix of non-ASCII mathematical notation and program control structures. Then the code can be parsed and interpreted by a machine.

Several formal specification languages include set theory notation using special characters. Examples are:

Some array programming languages include vectorized expressions and matrix operations as non-ASCII formulas, mixed with conventional control structures. Examples are:

See also

edit

References

edit
  1. ^ Reisig 2007, p. 23, Pseudocode Programs and Their Semantics.
  2. ^ An often-repeated definition of pseudocode since at least 2003 is "a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language"
  3. ^ Ulate-Caballero, Bryan Alexander; Berrocal-Rojas, Allan; Hidalgo-Céspedes, Jeisson (2021). "Concurrent and Distributed Pseudocode: A Systematic Literature Review". 2021 XLVII Latin American Computing Conference (CLEI). pp. 1–10. doi:10.1109/CLEI53233.2021.9640222. ISBN 978-1-6654-9503-5.
  4. ^ Mitchell et al. 1996, p. 105.
  5. ^ McConnell, Steve (2004). Code Complete. Pearson Education. p. 54. ISBN 978-0-7356-1967-8. Avoid syntactic elements from the target programming language
  6. ^ Invitation to Computer Science, 8th Edition by Schneider/Gersting, "Keep statements language independent" as quoted in this stackexchange question
  7. ^ Lamport, Leslie (2 January 2009). "The PlusCal Algorithm Language" (PDF). Microsoft Research. Retrieved 28 May 2024.

Further reading

edit
edit
来大姨妈不能吃什么水果 泌尿科挂什么科 樱花什么时候开花 阿拉伯人属于什么人种 血小板低有什么危害
彩超和ct有什么区别 呕心沥血是什么意思 左手中指痛什么预兆 扫把星代表什么生肖 怀孕了梦见蛇是什么意思
113是什么意思 牛奶加咖啡叫什么 肺结核传染途径是什么 湿气重有什么症状 性冷淡是什么意思
为什么会宫颈糜烂 cm医学上是什么意思 吃什么补脑 小柴胡颗粒治什么病 消防支队长是什么级别
熬夜到什么程度会猝死hcv9jop0ns7r.cn 什么地问hcv8jop2ns2r.cn 碳水化合物是什么wuhaiwuya.com gdp是什么hcv7jop6ns9r.cn 什么人不能吃西瓜hcv7jop6ns6r.cn
mdzz是什么意思hcv7jop5ns4r.cn 左肾小囊肿是什么意思clwhiglsz.com 什么是非处方药hcv7jop5ns1r.cn 多梦吃什么药效果最好hcv8jop4ns2r.cn 什么牌子的氨基酸洗面奶好tiangongnft.com
人乳头瘤病毒39型阳性是什么意思hcv8jop5ns7r.cn 太妃是皇上的什么人hcv8jop5ns6r.cn 野生葛根粉有什么功效hcv7jop9ns9r.cn 桃子吃了有什么好处hcv8jop0ns9r.cn 不容乐观是什么意思beikeqingting.com
手指缝里长水泡还痒是什么原因hcv7jop7ns1r.cn 吃护肝片有什么副作用hcv9jop4ns7r.cn 罗汉果泡水有什么好处hcv7jop9ns8r.cn 黄鼻涕是什么感冒hcv8jop2ns6r.cn 紫苏是什么东西hcv8jop7ns2r.cn
百度