Skip to content

Conversation

@Ramy-Badr-Ahmed
Copy link
Member

@Ramy-Badr-Ahmed Ramy-Badr-Ahmed commented Sep 10, 2024

Description:

This pull request introduces an implementation of the Gnome Sort algorithm.

Definition:

  • Gnome Sort is a simple, comparison-based sorting algorithm that is conceptually similar to insertion sort.
  • The Algorithm works by iterating through the array, comparing adjacent elements, and swapping them if they are in the wrong order. If a swap occurs, it steps back and continues checking until the array is sorted.
  • Gnome Sort has a time complexity of O(n²). Certainly not a suitable choice for large datasets
  • is less efficient than algorithms like Heap Sort Implemented Heap Sort Algorithm #8 or Merge Sort Implemented Merge Sort Algorithm #7 for large datasets

Implementation Details:

gnome_sort.f90: Contains the gnome_sort_module with:

gnome_sort: A subroutine that sorts the input array using the Gnome Sort algorithm.
swap: A helper subroutine that swaps two elements in the array.

The implementation follows the module structure as outlined in the contribution guidelines.

Example Usage:

example_usage_gnome_sort.f90: A test program that demonstrates the gnome_sort subroutine from the gnome_sort_module. It sorts a sample array and prints the results.

Additional Test Cases:

tests_gnome_sort.f90: A test program that includes a variety of test cases to validate the gnome_sort implementation.

Copy link
Member Author

@Ramy-Badr-Ahmed Ramy-Badr-Ahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SatinWukerORIG ,
Looking forward to your review 🙂

@Ramy-Badr-Ahmed Ramy-Badr-Ahmed changed the title Gnome Sort Implementation Implemented Gnome Sort Algorithm Sep 10, 2024
Ramy-Badr-Ahmed

This comment was marked as outdated.

Copy link
Member Author

@Ramy-Badr-Ahmed Ramy-Badr-Ahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more test cases for the gnome_sort module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants