# Tutor profile: Daniel N.

## Questions

### Subject: Javascript Programming

Write a function called sumOfNumbers that takes in parameter arrayOfNumbers that returns the average of all the values in a single array of numbers in javascript? Note: arrayOfNumbers is an array.

function sumOfNumbers(arrayOfNumbers){ var sum = 0; for(var i =0; i<arrayOfNumbers.length; i++){ sum = sum + arrayOfNumbers[i]; } var averageResult = sum/arrayOfNumbers.length; return averageResult; }

### Subject: Basic Math

How do you find the average, median, and mode of a given data set?

Average: You add up the numbers and after finding the sum, you divide that number by the total amount of numbers there are. Median: First you order the numbers in ascending order (least to greatest). Afterwords you find the middle number. If there are two numbers that split the middle, you can take average the two numbers to find the median. Mode: To make this easy, you can order the numbers in ascending order (least to greatest). After sorted, you just find which number appears the most. There can be multiple modes if needed.

### Subject: Computer Science (General)

Given an array of numbers (i.e. [4, ,2, 7, 11]) and a random number (i.e. 13), describe how you would go about checking if 2 numbers in that array sum to the random number?

First method is you could use a double "for loop" to iterate through each of the numbers checking if any sum of two numbers equals the random number. If two numbers sum up to the random number you can return true. Second method you could use a hashmap and map through that in order to see if 2 numbers sum up to the random number. If the compliment of the selected number exists in the hash, then return true.

## Contact tutor

needs and Daniel will reply soon.