TimeComplexity enum

Represents the time complexity of an algorithm using Big O notation. Ordered from best (O(1)) to worst (O(2^n)) for ranking purposes.

Inheritance
Available extensions

Values

o1 → const TimeComplexity

Constant time - O(1)

const TimeComplexity('O(1)', 0)
oLogN → const TimeComplexity

Logarithmic time - O(log n)

const TimeComplexity('O(log n)', 1)
oN → const TimeComplexity

Linear time - O(n)

const TimeComplexity('O(n)', 2)
oVPlusE → const TimeComplexity

Graph traversal time - O(V + E)

const TimeComplexity('O(V + E)', 2)
oNLogN → const TimeComplexity

Linearithmic time - O(n log n)

const TimeComplexity('O(n log n)', 3)
oN2 → const TimeComplexity

Quadratic time - O(n²)

const TimeComplexity('O(n²)', 4)
oN3 → const TimeComplexity

Cubic time - O(n³)

const TimeComplexity('O(n³)', 5)
o2N → const TimeComplexity

Exponential time - O(2^n)

const TimeComplexity('O(2^n)', 6)

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
notation → String
Human-readable notation (e.g., "O(n log n)")
final
rankValue → int
Numeric value for ranking (lower is better)
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(TimeComplexity other) → int
Compare complexities for sorting (better complexities come first)
isBetterThan(TimeComplexity other) → bool
Returns true if this complexity is strictly better than the other
isBetterThanOrEqualTo(TimeComplexity other) → bool
Returns true if this complexity is better than or equal to the other
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

values → const List<TimeComplexity>
A constant List of the values in this enum, in order of their declaration.