We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function bubble(arrs) { for (let i = 0 ; i< arrs.length; i++){ for (let j = 0 ;j<arrs.length-i;j++){ if(arrs[j]>arrs[j+1]){ let temp temp = arrs[j] arrs[j] = arrs[j+1] arrs[j+1] = temp } } console.log(arrs) }
} let arrs1 = [4,3,2,1,4,3,2,4,5,74,765,75,3,3,6,5]
bubble(arrs1)
时间复杂度 O(n的平方) 空间复杂度 O(1)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
function bubble(arrs) {
for (let i = 0 ; i< arrs.length; i++){
for (let j = 0 ;j<arrs.length-i;j++){
if(arrs[j]>arrs[j+1]){
let temp
temp = arrs[j]
arrs[j] = arrs[j+1]
arrs[j+1] = temp
}
}
console.log(arrs)
}
}
let arrs1 = [4,3,2,1,4,3,2,4,5,74,765,75,3,3,6,5]
bubble(arrs1)
时间复杂度 O(n的平方)
空间复杂度 O(1)
The text was updated successfully, but these errors were encountered: