# CS1021 Assignment #2 Memory

\$30.00

## Description

1 Sets – Closure
Assume a mathematical set, A, containing 32-bit signed integers is stored in memory. The
following ARM Assembler directives illustrate how the set is arranged in memory.
1 ASi ze DCD 8 ; Number o f e l em e n t s i n Se t A
2 AElems DCD +4,−6,−4,+3,−8,+6,+8,−3 ; El em e n t s i n Se t A
Design and write an ARM Assembly Language program that will determine whether the set is
closed under the negation operation. In other words, your program should determine whether, for
every integer in the set, the set also contains the negation of that integer.
The set A in the example above is closed under the negation operation as it contains both +3
and -3, +4 and -4, +6 and -6 and +8 and -8.
Use the Closure µVision project to develop your solution. Your program should store 1 in R0 if
the set is closed under negation and zero otherwise.
Page 1 of 2
School of Computer Science and Statistics
CS1021 / Introduction to Computing I
2 Sets – Symmetric Difference
Assume two mathematical sets, A and B, containing 32-bit unsigned integers are stored in memory.
The following ARM Assembler directives illustrate how the sets are arranged.
1 ASi ze DCD 8 ; Number o f e l em e n t s i n Se t A
2 AElems DCD 4 , 6 , 2 , 1 3 , 1 9 , 7 , 1 , 3 ; El em e n t s i n Se t A
3
4 BSi ze DCD 6 ; Number o f e l em e n t s i n Se t B
5 BElems DCD 1 3 , 9 , 1 , 2 0 , 5 , 8 ; El em e n t s i n Se t B
Design and write an ARM Assembly Language program that will create a third set, C, that is the
symmetric difference of A and B.
Use the SymmDiff µVision project to develop your solution. Your program should store the size
and elements of set C in memory using the memory set aside in the template project.
3 Anagrams
Two strings are anagrams of each other if one string can be formed by rearranging the characters
of the other. Each letter of one string may only be used once to form the other string. For
example, ”tacos” is an anagram of ”coats”. The string ”bests” is not, however, an anagram of
”beets” because although they contain the same characters, each character does not occur the
same number of times.
Design and write an ARM Assembly Language program to determine if one string is an anagram
of another string.
Use the Anagram µVision project to develop your solution. The template code in the project
stores the start address of string A in R1 and the start address of string B in R2. Your program
should store 1 in R0 if the string is an Anagram and zero otherwise.
Evaluation
The following broad marking scheme will be used for the assignment:
• Closure – 25%
• Symmetric Difference – 25%
• Anagrams – 25%
• Documentation – 25%
Note that marks will be awarded for both the content and presentation of your report document.
Solutions that are merely working will not automatically attract 100% of the marks available.
Marks will also be awarded for the quality of the solution.
Page 2 of 2