https://github.com/nelsonbn/algorithms-data-structures-shell-sort
Algorithms and Data Structures - Shell Sort
https://github.com/nelsonbn/algorithms-data-structures-shell-sort
algorithms algorithms-and-data-structures data-structures
Last synced: about 1 year ago
JSON representation
Algorithms and Data Structures - Shell Sort
- Host: GitHub
- URL: https://github.com/nelsonbn/algorithms-data-structures-shell-sort
- Owner: NelsonBN
- License: mit
- Created: 2024-07-11T02:15:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-02T13:30:33.000Z (about 1 year ago)
- Last Synced: 2025-03-02T14:28:49.458Z (about 1 year ago)
- Topics: algorithms, algorithms-and-data-structures, data-structures
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Algorithms and Data Structures - Shell Sort
Shell Sort is a generalization of Insertion Sort. It was created by Donald Shell in 1959.
Here an example of the [Insertion Sort](https://github.com/NelsonBN/algorithms-data-structures-insertion-sort)
## Characteristics
- Time complexity:
- Best: Ω(n log(n)) -> Depends on the gap sequence
- Average: Θ(n^(3/2)) -> Depends on the gap sequence
- Worst: O(n^2) -> Depends on the gap sequence
- Space complexity: O(1)
- In-place
- Unstable
## Demos:
- [Original Implementation with tmp variable](./src/with_tmp_variable.py)
- [Original Implementation without tmp variable](./src/without_tmp_variable.py)
- [Knuth's Sequence](./src/knuth.py)
- [Hibbard's Sequence](./src/hibbard.py)
- [Sedgewick's Sequence](./src/sedgewick.py)
- [Comparisons all versions](./src/comparisons.py)
## Demonstration
- [Algorithm Visualizer](https://algorithm-visualizer.org/brute-force/shellsort)
## References
- [Other Algorithms & Data Structures](https://github.com/NelsonBN/algorithms-data-structures)
- [A High-Speed Sorting Procedure - D.L. Shell](https://dl.acm.org/doi/pdf/10.1145/368370.368387)