Post

CRX Design System Sample Post
Avatar
Learning Sutras
by Champak Roy



Program

Bubble Sort Visualization

Step by step visualization of bubble sort.

Laptop

Laptops under ₹50,000

★★★★☆
₹49,999
Buy on Amazon


What is 2 + 2?
2
3
4
5



❤️ Support my work

Your donation keeps the blog running.


Hello! How can I help?
Show me bubble sort.




function bubbleSort(arr) {
  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr.length - i - 1; j++) {
      if (arr[j] > arr[j + 1]) {
        [arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];
      }
    }
  }
  return arr;
}
    

0 Comments

Post a Comment

0 Comments