Update data_structures/arrays/sort_squares_of_an_array.rb

Co-authored-by: Vitor Oliveira <vbrazo@gmail.com>
This commit is contained in:
Jessica Kwok 2021-03-10 15:02:55 -08:00 committed by GitHub
parent 92f09581f6
commit f9e7cd677d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,8 @@ def bubble_sort(array)
end
#
# Time complexity analysis for Approach 1 & 2
# Time complexity: O(n logn), where n is the length of the array.
# Space complexity: O(n) or O(logn)
#
def sorted_squares(nums)
@ -83,4 +84,4 @@ def sorted_squares(nums)
output
end
print(sorted_squares([4, -1, -9, 2]))
print(sorted_squares([4, -1, -9, 2]))