Giter Site home page Giter Site logo

jrjaro18 / go-sort Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 7 KB

go-sort is a Go package that provides a concurrent implementation of the Quick Sort algorithm for sorting slices of integers, unsigned integers, and floats in ascending order.

License: MIT License

Go 100.00%
golang goroutines quicksort sorting-algorithms

go-sort's Introduction

go-sort

go-sort is a Go package that provides a concurrent implementation of the Quick Sort algorithm for sorting slices of integers, unsigned integers, and floats in ascending order.

Installation

To use gosort in your Go project, simply import it using the following import statement:

import "github.com/jrjaro18/gosort"

Then, install the package by running:

go get github.com/jrjaro18/gosort

Usage

package main

import (
    "fmt"
    "github.com/jrjaro18/gosort"
)

func main() {
    // Example usage with a slice of integers
    integers := []int{5, 3, 7, 1, 9, 2, 6, 4, 8}
    fmt.Println("Unsorted:", integers)

    // Sorting the slice using gosort
    gosort.Sort(&integers)
    fmt.Println("Sorted:", integers)
}

Performance Comparison

Test Conditions:

  • Hardware:

    • Processor: 4.7 GHz Intel Core i7-1165G7
    • Ram: 16 GB LPDDR4X
  • Go version: 1.21.3

Quick Sort vs. go-sort (Concurrent Quick Sort)

1 Million Numbers:

  • Traditional Quick Sort: 104 milliseconds
  • go-sort Quick Sort: 77 milliseconds

10 Million Numbers:

  • Traditional Quick Sort: 1.29 seconds
  • go-sort Quick Sort: 327 milliseconds

100 Million Numbers:

  • Traditional Quick Sort: 13 seconds
  • go-sort Quick Sort: 3 seconds

Analysis:

  • go-sort consistently outperforms traditional Quick Sort, showcasing significant speed enhancements across varying dataset sizes.
  • The concurrent nature of gosort's implementation leverages Go's goroutines, resulting in improved efficiency, particularly evident with larger datasets.
  • These performance gains make gosort a compelling choice for applications requiring high-speed sorting of large datasets.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.


go-sort's People

Contributors

jrjaro18 avatar

Stargazers

Clayton Kehoe avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.