Write algo for GCD?
while(item2 > 0) {
long temp = item2;
item2 = item1%item2;
item1 = temp;
}return item1;
What are the common property of discrete mathematics
Commutative
Associative
Distrubutive
State the algo change problem?
Map denominationMap = new HashMap(); int i = denomination.length -1; int usages = 0;
while(change > 0 ) {
if(denomination[i] <= change) {
usages = 0;
usages = change/denomination[i]; //(change - (change % denomination[i])) / denomination[i];
change = change%denomination[i];
denominationMap.put(denomination[i], usages);
}
i--; // as i must reduce , thus keeping out of if
}
return denominationMap;How do the proportions get solved
By cross multiplication
What is the another way of saying percentage
Another way to say this is “Find out what number is the same part of 180 as 30 is of 100.”
Should the words be converted to the operators and abstract functions in maths and coding?
Yes for e.g. johs age is 4 times ram, so the is converts into
j = 4r
What is the operator conversion of : sum/and less than/opposite product/times of is
sum/and +
less than/opposite -
product/times of *
is =