Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Lesyk committed Sep 14, 2019
1 parent 98f2067 commit d6b41f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Toolbox of software data structures, design patterns, algorithms and typical pro
> Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted. The algorithm, which is a comparison sort, is named for the way smaller or larger elements "bubble" to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort. Bubble sort can be practical if the input is in mostly sorted order with some out-of-order elements nearly in position.
| Algorithm | Time Complexity | | | Space Complexity |
| | Best | Average | Worst | Worst |
| ------------- |----------------:| -------:|----------:|-----------------:|
| | Best | Average | Worst | Worst |
| Bubble Sort | Θ(n) | Θ(n^2) | Θ(n^2) | Θ(1 ) |

### Swift
Expand Down Expand Up @@ -88,8 +88,8 @@ console.log(bubbleSort(numbers));
> Insertion sort is a simple sorting algorithm that is relatively efficient for small lists and mostly sorted lists, and is often used as part of more sophisticated algorithms. It works by taking elements from the list one by one and inserting them in their correct position into a new sorted list similar to how we put money in out wallet. In arrays, the new list and the remaining elements can share the array's space, but insertion is expensive, requiring shifting all following elements over by one. Shellsort (see below) is a variant of insertion sort that is more efficient for larger lists.
| Algorithm | Time Complexity | | | Space Complexity |
| | Best | Average | Worst | Worst |
| -------------- |----------------:| --------:|----------:|-----------------:|
| | Best | Average | Worst | Worst |
| Insertion Sort | Ω(n) | Θ(n^2) | Θ(n^2) | Θ(1 ) |

### Swift
Expand Down Expand Up @@ -169,8 +169,8 @@ console.log(insertionSort(unsortedArray));
> The algorithm finds the minimum value, swaps it with the value in the first position, and repeats these steps for the remainder of the list. It does no more than n swaps, and thus is useful where swapping is very expensive.
| Algorithm | Time Complexity | | | Space Complexity |
| | Best | Average | Worst | Worst |
| -------------- |----------------:| -------:|----------:|-----------------:|
| | Best | Average | Worst | Worst |
| Selection sort | Ω(n^2) | Θ(n^2) | Θ(n^2) | Θ(1 ) |

### Swift
Expand Down

0 comments on commit d6b41f4

Please sign in to comment.