Question: In this project, you are required to implement a set of min - heap operations in ARM assembly language. You will use KEIL simulator to

In this project, you are required to implement a set of min-heap operations in ARM assembly
language. You will use KEIL simulator to develop and test your code.
First of all, you will implement the min-heap data structure (which has the logical structure of a
nearly complete binary tree) as an array of 32-bit integers. The first element in the array A[0] is the
size of the heap, i.e. the number of elements in the heap (i.e the integer size) is in A[0]. The rest
of the elements in A (A[1] to A[size]) are the values in the nodes of the binary tree.
Fundamental property of a min-heap is that for every node i other than the root, A[parent(i)]= A[i],
that is, the value of a node is at most the value of its parent. If a node is at the kth location in the
array, its children will be at the (2k) and the(2k+1) locations of the array. The following figures gives
three different min-heaps which have 6,4 and 3 nodes.
Figure 1: Three sample min-heaps with a)6 nodes, b)4 nodes and c)2 nodes.
Procedures of the Project
I. build (list, heap)
This procedure constructs a min-heap data structure from a list of integers. The values of the
integers in the list are in no particular order, but they are located in successive memory locations,
from first to last. The address of the first integer is in the list argument (given in R0); and assume
that the list is terminated by a special value, -MAXINT, the negative integer with
the largest possible absolute value. The address of the place where the procedure should create
the data structure is in heap argument (given in R1).
II. find (value, heap)
This procedure finds a particular value (given in R0 register) in the min-heap, where the address of
the first item of the data structure is in heap argument (given in R1). The search result should be
stored in R0 register. If the item is found R0=1, otherwise R0=0. If the value is found in the heap,
R1 should contain its address. For this procedure, the original data structure (heap) should be
unmodified.
III. sort (size, heap)
This procedure sorts the elements using the heap structure. Procedure takes two arguments: size
of array (given in R0 register) and the address of the first item of the data structure is in heap
argument (given in R1). End of the operation the address of the first element of sorted list should
be in R0 register.Figure 1.a
Figure 1.b
Figure 1.c
Figure 1: Three sample min-heaps with a)6 nodes, b)4 nodes and c)2 nodes.
In this project, you are required to implement a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!