the ones in their teens (idk im guessing but i mean this could be helpful you never know)
Answer:
to help focus, or to enhance something you are watching
Explanation:
if you are working on something it helps you think about your assignments or what ever you're working on, if its in a movie ot video or something to be watch it helps set the mood for what is happening
Answer: To help recognize the mood of what you ware watching.
Explanation: Let's say you have a suspenseful movie, you would want to put suspenseful music that matches the mood to help enhance it and make it more clear.
Hope this helps!
A key step in many sorting algorithms (including selection sort) is swapping the location of two items in an array. Here's a swap function that looks like it might work, but doesn't:
-the code prints out [9, 9, 4] when it should print out [9, 7, 4].
Fix the swap function.
Hint: Work through the code line by line, writing down the values of items in the array after each step. Could you use an extra temporary variable to solve the problem that shows up?
Once implemented, uncomment the Program.assertEqual() at the bottom to verify that the test assertion passes.
the layout for javascript is,
var swap = function(array, firstIndex, secondIndex) {
array[firstIndex] = array[secondIndex];
array[secondIndex] = array[firstIndex];
};
var testArray = [7, 9, 4];
swap(testArray, 0, 1);
println(testArray);
//Program.assertEqual(testArray, [9, 7, 4]);
The problem with the swap function is that it loses the value at the first index, as soon as it gets overwritten by the value at the second index. This happens in the first statement. To fix it, you need a helper variable.
First you're going to "park" the index at the first index in that helper variable, then you can safely overwrite it with the value at the second index. Then finally you can write the parked value to the second index:
var swap = function(array, firstIndex, secondIndex) {
let helper = array[firstIndex];
array[firstIndex] = array[secondIndex];
array[secondIndex] = helper;
};
I hope this makes sense to you.