Assembly Language

Homework 8, Due 2010/5/24

Problem 1

Factorial comparison (Page 268, Problem 4)

Write a program that compares the runtime speeds of both the recursive Factorial procedure from Section 8.3.2 and the nonrecursive Factorial procedure written for the preceding programming exercise.

Use the GetMseconds procedure from the book's link library to measure and display the number of milliseconds required to call each Factorial procedure several thousand times in a row.

 

t8_1.exe

 

Problem 2

Str_concat proceduree (Page 295, Problem 2)

Write a procedure named Str_concat that concatenates a source string to the end of a target string. Sufficient space must be available in the target string before this procedure is called.

Pass pointers to the source and target strings.

 

t8_2.exe

 Problem 3

Bubble sort (Page 297, Problem 8)

Add a variable to the BubbleSort procedure in Section 9.5.1 that is set to 1 whenever a pair of values is exchanged within the inner loop. Use this variable to exit the sort before its normal completion if you discover that no exchanges took place during a complete pass through the array. (This variable is commonly known as an exchange flag.)

 

t8_3.exe

 

ftp your homework to

ftp://alasp8@140.127.208.168/

in the directory \HW8

by the following format:

檔案名稱:hw#_學號.zip

例如:資工同學,作業4

    檔案名稱:hw4_a09755xx.zip.  (注意:檔案名稱不能有中文)

The password is given in class.