Skip to content

Improve docstrings in insertion_sort.py to include complexity analysis #14866

Description

@dhruv-gautam-dev

What would you like to share?

The insertion_sort() function in sorts/insertion_sort.py is missing
time and space complexity information in its docstring.

Proposed addition:

  • Time Complexity: O(n^2) - worst and average case
  • Time Complexity: O(n) - best case (already sorted)
  • Space Complexity: O(1) - sorts in place

This helps students and developers understand the performance
characteristics of the algorithm.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting triageAwaiting triage from a maintainer

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions