PS -101 Flashcards

1
Q

Write algo for GCD?

A
while(item2 > 0) {
			long temp = item2;
			item2 = item1%item2;
			item1 = temp;
		}
	return item1;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the common property of discrete mathematics

A

Commutative
Associative
Distrubutive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

State the algo change problem?

A
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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do the proportions get solved

A

By cross multiplication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the another way of saying percentage

A

Another way to say this is “Find out what number is the same part of 180 as 30 is of 100.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Should the words be converted to the operators and abstract functions in maths and coding?

A

Yes for e.g. johs age is 4 times ram, so the is converts into
j = 4r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
What is the operator conversion of :
sum/and 
less than/opposite
product/times of
is
A

sum/and +
less than/opposite -
product/times of *
is =

How well did you know this?
1
Not at all
2
3
4
5
Perfectly