Difference between revisions of "Template:Infobox algorithm"
Jump to navigation
Jump to search
Template documentation
imported>Luckas-bot m ([r2.6.2] robot Adding: pt:Predefinição:Info/Algoritmo) |
imported>Enervation (Edit templatedata) |
||
| (24 intermediate revisions by 23 users not shown) | |||
| Line 1: | Line 1: | ||
{{Infobox | {{Infobox | ||
| headerstyle = background:#ffc0c0 | | headerstyle = background:#ffc0c0 | ||
| − | | title = {{{name|{{ | + | | title = {{{name|{{PAGENAMEBASE}}}}} |
| − | | image | + | | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image size|{{{image_size|{{{imagesize|}}}}}}}}}|alt={{{alt|}}}}} |
| caption = {{{caption|}}} | | caption = {{{caption|}}} | ||
| label1 = Class | | label1 = Class | ||
| Line 8: | Line 8: | ||
| label2 = Data structure | | label2 = Data structure | ||
| data2 = {{{data}}} | | data2 = {{{data}}} | ||
| − | | label3 = [[Best, worst and average case|Worst case performance]] | + | | label3 = [[Best, worst and average case|Worst-case]] [[Time complexity|performance]] |
| − | | data3 | + | | data3 = {{{time}}} |
| − | | label4 = [[Best, worst and average case|Best case performance]] | + | | label4 = [[Best, worst and average case|Best-case]] [[Time complexity|performance]] |
| − | | data4 | + | | data4 = {{{best-time|}}} |
| − | | label5 = [[Best, worst and average case|Average | + | | label5 = [[Best, worst and average case|Average]] [[Time complexity|performance]] |
| data5 = {{{average-time|}}} | | data5 = {{{average-time|}}} | ||
| − | | label6 = [[Best, worst and average case|Worst case space complexity]] | + | | label6 = [[Best, worst and average case|Worst-case]] [[space complexity]] |
| data6 = {{{space}}} | | data6 = {{{space}}} | ||
| − | }}<noinclude>{{ | + | }}<noinclude> |
| + | {{Documentation|content= | ||
| + | == Usage == | ||
| + | <pre> | ||
{{Infobox algorithm | {{Infobox algorithm | ||
| − | |name= <!-- Defaults to article name --> | + | |name = <!-- Defaults to article name --> |
| − | |class= <!-- Name of problem it solves --> | + | |class = <!-- Name of problem it solves --> |
| − | |image= | + | |image = |
| − | |caption= | + | |caption = |
| − | |data= | + | |data = |
| − | |time= <!-- Worst time big-O notation --> | + | |time = <!-- Worst time big-O notation --> |
| − | |best-time= | + | |best-time = |
| − | |average-time= | + | |average-time = |
| − | |space= | + | |space = <!-- Worst-case space complexity; auxiliary space |
| + | (excluding input) if not specified --> | ||
}} | }} | ||
</pre> | </pre> | ||
| − | + | <templatedata> | |
| − | + | { | |
| − | + | "description": "Infobox describing an algorithm", | |
| − | + | "params": { | |
| − | + | "name": { | |
| − | [[ | + | "label": "Name", |
| + | "description": "Name of algorithm", | ||
| + | "type": "content", | ||
| + | "required": true, | ||
| + | "default": "{{PAGENAMEBASE}}", | ||
| + | "autovalue": "{{PAGENAMEBASE}}", | ||
| + | "suggested": true | ||
| + | }, | ||
| + | "class": { | ||
| + | "label": "Problem class", | ||
| + | "description": "Type of problem it solves", | ||
| + | "type": "content", | ||
| + | "required": true, | ||
| + | "example": "Sorting", | ||
| + | "autovalue": "", | ||
| + | "suggested": true | ||
| + | }, | ||
| + | "image": { | ||
| + | "type": "content", | ||
| + | "label": "Image" | ||
| + | }, | ||
| + | "caption": { | ||
| + | "type": "content", | ||
| + | "label": "Caption" | ||
| + | }, | ||
| + | "data": { | ||
| + | "label": "Data structure", | ||
| + | "description": "Data structure operated upon", | ||
| + | "type": "content", | ||
| + | "example": "Array", | ||
| + | "required": true, | ||
| + | "suggested": true | ||
| + | }, | ||
| + | "time": { | ||
| + | "label": "Worst-case time complexity", | ||
| + | "description": "Worst-case time complexity in big O notation", | ||
| + | "type": "content", | ||
| + | "required": true, | ||
| + | "suggested": true, | ||
| + | "example": "O(n)" | ||
| + | }, | ||
| + | "best-time": { | ||
| + | "label": "Best-case time complexity", | ||
| + | "type": "content" | ||
| + | }, | ||
| + | "average-time": { | ||
| + | "label": "Average time complexity", | ||
| + | "type": "content" | ||
| + | }, | ||
| + | "space": { | ||
| + | "label": "Worst-case space complexity", | ||
| + | "required": true, | ||
| + | "description": "If not specified, this should be auxiliary space complexity and not include the space needed for the input", | ||
| + | "type": "content", | ||
| + | "suggested": true, | ||
| + | "example": "O(1)" | ||
| + | }, | ||
| + | "alt": { | ||
| + | "label": "Alt text", | ||
| + | "description": "Alt text for image", | ||
| + | "type": "string" | ||
| + | }, | ||
| + | "size": { | ||
| + | "aliases": [ | ||
| + | "image size", | ||
| + | "imagesize", | ||
| + | "image_size" | ||
| + | ], | ||
| + | "label": "Image size" | ||
| + | } | ||
| + | }, | ||
| + | "paramOrder": [ | ||
| + | "name", | ||
| + | "class", | ||
| + | "image", | ||
| + | "size", | ||
| + | "alt", | ||
| + | "caption", | ||
| + | "data", | ||
| + | "time", | ||
| + | "best-time", | ||
| + | "average-time", | ||
| + | "space" | ||
| + | ] | ||
| + | } | ||
| + | </templatedata> | ||
| + | }} | ||
| + | [[Category:Computer science infobox templates|Algorithm]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 23:49, 11 August 2020
| Class | {{{class}}} |
|---|---|
| Data structure | {{{data}}} |
| Worst-case performance | {{{time}}} |
| Worst-case space complexity | {{{space}}} |
[[Category:Infobox templates|Template:Remove first word]]
Usage
{{Infobox algorithm
|name = <!-- Defaults to article name -->
|class = <!-- Name of problem it solves -->
|image =
|caption =
|data =
|time = <!-- Worst time big-O notation -->
|best-time =
|average-time =
|space = <!-- Worst-case space complexity; auxiliary space
(excluding input) if not specified -->
}}
Infobox describing an algorithm
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Name | name | Name of algorithm
| Content | required |
| Problem class | class | Type of problem it solves
| Content | required |
| Image | image | no description | Content | optional |
| Image size | size image size imagesize image_size | no description | Unknown | optional |
| Alt text | alt | Alt text for image | String | optional |
| Caption | caption | no description | Content | optional |
| Data structure | data | Data structure operated upon
| Content | required |
| Worst-case time complexity | time | Worst-case time complexity in big O notation
| Content | required |
| Best-case time complexity | best-time | no description | Content | optional |
| Average time complexity | average-time | no description | Content | optional |
| Worst-case space complexity | space | If not specified, this should be auxiliary space complexity and not include the space needed for the input
| Content | required |
| Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Subpages of this template. |