{"ScriptPreparationCode":"window.arr = [5,3,8,4,6]\r\n\r\nwindow.bubbleSort = (arr) =\u003E {\r\n for(let i = 0; i \u003C arr.length; i\u002B\u002B){\r\n for(let j = 0; j \u003C arr.length - i - 1; j\u002B\u002B){\r\n if(arr[j \u002B 1] \u003C arr[j]){\r\n [arr[j \u002B 1],arr[j]] = [arr[j],arr[j \u002B 1]]\r\n }\r\n }\r\n };\r\n return arr;\r\n}\r\n\r\nwindow.insertionSort = (arr) =\u003E {\r\n for(let i = 1; i \u003C arr.length;i\u002B\u002B){\r\n for(let j = i - 1; j \u003E -1; j--){\r\n if(arr[j \u002B 1] \u003C arr[j]){\r\n [arr[j\u002B1],arr[j]] = [arr[j],arr[j \u002B 1]];\r\n }\r\n }\r\n };\r\n return arr;\r\n}","TestCases":[{"Name":"bubbleSort","Code":"window.bubbleSort(window.arr);","IsDeferred":false},{"Name":"Insertion Sort","Code":"window.insertionSort(window.arr);","IsDeferred":false}]}