Template:Infobox algorithm/doc

From The Global Wiki
< Template:Infobox algorithm
Revision as of 21:04, 14 February 2022 by en>Shkuru Afshar
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Example

Quicksort Algorithm

Quicksort Algorithm
File:Sorting quicksort anim.gif
Animated visualization of the quicksort algorithm. The horizontal lines are pivot values.
ClassSorting algorithm
Worst-case performanceO(n2)
Best-case performanceO(n log n) (simple partition)
or O(n) (three-way partition and equal keys)
Average performanceO(n log n)
Worst-case space complexityO(n) auxiliary (naive)
O(log n) auxiliary (Hoare 1962)

Usage

{{Infobox algorithm
|name           = <!-- Defaults to article name -->
|class          = <!-- Name of problem it solves -->
|image          = <!-- filename only, no "File:" or "Image:" prefix, and no enclosing [[brackets]] -->
|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

Template parameters

ParameterDescriptionTypeStatus
Namename

Name of algorithm

Default
{{PAGENAMEBASE}}
Auto value
{{PAGENAMEBASE}}
Contentrequired
Problem classclass

Type of problem it solves

Example
Sorting
Auto value
Contentrequired
Imageimage

filename only, no 'File:' or 'Image:' prefix, and no enclosing [[brackets]]

Contentoptional
Image sizesize image size imagesize image_size

no description

Unknownoptional
Alt textalt

Alt text for image

Stringoptional
Captioncaption

no description

Contentoptional
Data structuredata

Data structure operated upon

Example
Array
Contentrequired
Worst-case time complexitytime

Worst-case time complexity in big O notation

Example
O(n)
Contentrequired
Best-case time complexitybest-time

no description

Contentoptional
Average time complexityaverage-time

no description

Contentoptional
Worst-case space complexityspace

If not specified, this should be auxiliary space complexity and not include the space needed for the input

Example
O(1)
Contentrequired