Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

bubble sort

const bubbleSort = (arr) => {
  for (let i = 0; i < arr.length - 1; i++) {
    for (let j = 0; j < arr.length - 1; j++) {
      // compare arr[j] to arr[j+1]
      // swap places if needed
    }
  }

  return arr;
};
Source by courses.bootcampspot.com #
 
PREVIOUS NEXT
Tagged: #bubble #sort
ADD COMMENT
Topic
Name
8+7 =