1. Show that the one to one function f -1 : N 10 -> N b is the inverse of f: N b
ID: 3571099 • Letter: 1
Question
1. Show that the one to one function f-1 : N10 -> Nb is the inverse of f: Nb -> N10 (hint: show f-1 (f(nb)) = nb)
2. Let N16 = 3 6 A F D D 0 9 E D 4 B A A 1 6 F E B D
Find N8, N2, N10 using the mappings
N16 <=> N2<=> N8 <=> N2 <=> N10
3. Assume the numbesr n1, n2, ... nm
Write an algorithm that will perform iterative multiplication
Using this algorithm write a program to compute n = 34*226*12*44*5
Define a^N = aN
Write an algorithm to perform a^N
4. Write a program that will convert the number 23567 -> nb where b = 9
Write an algorithm that will convert a number nb to nc where b,c < 10
5. A polynomial is defined as Pn(x) = anxn + an-1xn-1 + ... + a1x + a0 where x is any number.
One way of evaluating P(x) without using exponents is to write
Pn(x) = (...(((anx + an-1)x + an-2)x + an-2)x + ... + a1)x + a0
Exmaple:
P3(x) = ((a3x + a2)x + a1)x + a0
P6(x) = (((((a6x + a5)x + a4)x + a3)x + a2)x + a1)x + a0
Write an algorithm which will perform Pn(x) using the avaluation of P(x) without using exponents with the following restrictions:
ak are integers and 0 ? ak ? 9
5) Write a program that will convert the number 238 to the base 5
6) Assume we want a program that will perform arithmetic in finite ring R = {0,1,2,...,N} base 10
Write a program that given any two numbers x, y in R will perform x?y, x?y, x?y
7) Write an assembly language program that will reaarange the numbers so that they are in increasing order as shown below
Do not add any additional variables
8) Perhaps the most important application of computers is the ability to sort data. Data is either sorted in ascending or descending order. For the following 4 numbers, we will state the tasks
that show how the bubble sort algorithm is applied using the IF-THEN statement to move the highest remaining numbers to the right:
List of numbers (unsorted).
Task 1: Move the highest number to variable X4:
Task 2: Move the next highest number to variable X3
:
Task 3: Move the next highest number to variable X2
Write a program using the bubble sort tasks to sort the numbers below in ascending order.
A B C D E BEFORE 40 30 10 50 20 AFTER 10 20 30 40 50Explanation / Answer
3)
equivalent of z = x*y:
z = 0;
if y < 0, x = 0-x, y = 0-y;
for i=1->y, z+=x;
5). We divide by 5 at each step and take the remainder.
238
47 3
9 2
1 4
0 1
and so (238)10 = (1423)5
7)
8)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.