Skip to content

Improve Bubble Sort docstrings with a more descriptive algorithm summary #14911

Description

@shreya-learn-explores

What would you like to share?

Description

The docstrings in sorts/bubble_sort.py provide only a very brief description of the Bubble Sort implementations.

Current docstrings:

  • bubble_sort_iterative(): "Pure implementation of bubble sort algorithm in Python"
  • bubble_sort_recursive(): "It is similar iterative bubble sort but recursive."

While these identify the implementations, they do not briefly explain how the Bubble Sort algorithm works. Adding a short algorithm summary would make the documentation more informative and beginner-friendly.

Expected Behavior

Expand the docstrings to include a concise explanation of the algorithm, for example that Bubble Sort repeatedly compares adjacent elements and swaps them until the collection is sorted.

Optionally, the docstrings could also mention the algorithm's average/worst-case time complexity and space complexity to improve the documentation.

Additional information

This is a documentation enhancement only. No changes to the algorithm or its behavior are required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting triageAwaiting triage from a maintainer

    Type

    No type

    Fields

    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