Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following recursive function S: LDR r2, [r0] CMP r2, #0 BNE L1 MOV R7,0 MOV PC, LR L1: LDR R3, [r2 #0] CMP R3,

The following recursive function S: LDR r2, [r0] CMP r2, #0 BNE L1 MOV R7,0 MOV PC, LR L1: LDR R3, [r2 #0] CMP R3, R1 BNE L2 MOV R7,1 L2: SUB SP, #4 STR LR, [SP] CMP R1, R3 BGE L3 LDR R0, [r2 #8] BL SEARCH B L4: L3: LDR R0, [r2, #4] BL SEARCH L4: LDR LR, [SP] ADD SP, #4 MOV PC, LR

where R0 points to a structure that looks like this [data, pointer to left child, pointer to right child] and R1 is an integer

a. What does this code do? Describe it b. Write in C or JAVA pseudo-code a version of this function c. Is this code tail-recursive? Explain it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logidata+ Deductive Databases With Complex Objects Lncs 701

Authors: Paolo Atzeni

1st Edition

354056974X, 978-3540569749

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago