[solved] – Question 99168
Write a program that asks the user to enter ten temperatures and then finds the sum. The input temperatures should allow for decimal values.
Sample Run
Enter Temperature: 27.6
Enter Temperature: 29.5
Enter Temperature: 35
Enter Temperature: 45.5
Enter Temperature: 54
Enter Temperature: 64.4
Enter Temperature: 69
Enter Temperature: 68
Enter Temperature: 61.3
Enter Temperature: 50
Sum = 504.3
Expert Answer
[solved] – Question 99178
Fun with find. Write a function to return the index of the value that is nearest to a desired
value. The function declaration should be: ind=findNearest(x, desiredVal). x is a
vector or matrix of values, and desiredVal is the scalar value you want to find. Do not
assume that desiredVal exists in x, rather find the value that is closest to desiredVal. If
multiple values (entries) have the same distance from desiredVal, return all of their indices.
Test your function to make sure it works on a few vectors and matrices. Useful functions are
abs, min, and find. Hint: You may have some trouble using min when x is a matrix. To convert a
matrix Q into a vector you can do something like y=Q(:). Then, doing m=min(y) will give
you the minimum value in Q. To find where this minimum occurs in Q, do ind=find(Q==m);
Expert Answer
[solved] – Question 99179
Loops and flow control. Make function called loopTest(N) that loops through the values 1
through N and for each number n it should display ‘n is divisible by 2’, ‘n is divisible by 3’, ‘n is
divisible by 2 AND 3’ or ‘n is NOT divisible by 2 or 3’. Use a for loop, the function mod or rem to
figure out if a number is divisible by 2 or 3, and num2str to convert each number to a string for
displaying. You can use any combination of if, else, and elseif.
Expert Answer
[solved] – Question 99194
Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each number on a separate line.
Expert Answer
[solved] – Question 99212
Quick Sort as explained in class uses a Pivot value to arrange all numbers greater than the pivot on one side and all values smaller than the pivot on the other side. Pivot in the class example used the first element of the array. “Median of three” rule uses the median of the first last and the middle elements of the array as the Pivot so that we avoid the chance of picking the smallest or the largest element in the array.
a)Write the status of the list F= (12,2,16, 30,8,28,4,10,20,6,18) at the end of each phase of recursive Quick sort using median of three rule to determine the pivot key. (20 points)
b)Show that recursive QuickSort takes O(n2) time when input list is already in sorted order(20 points)
c) Write a non recursive version of Quicksort incorporating the median of three rule to determine the pivot key. You can use the F array above from a) for your testing. (40 points)
d)Show that the non recursive version of Quicksort above takes O( n logn) time on already sorted list. (20 points)
Expert Answer
[solved] – Question 99214
assignment 5 animation.
How do i get started on a coding like this?
How do i tell a story behind it?
How long will this coding be?
Expert Answer
[solved] – Question 99228
If you are not using any STANDARD for your device manufacturing, then what sort of problems you may encounter?
Expert Answer
[solved] – Question 9923
Dim number As Integer
number = 1
Do While number <= 100
number = number + 1
Loop
IT SHOULD SHOW THE NUMBER b/w 1 to 100
Expert Answer
[solved] – Question 99238
Write code using the range function to add up the series 20, 30, 40, … 90 and print the resulting sum.
Expected output: 440
Expert Answer