This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture Notes CMSC 251 Since n/ 5 and 3 n/ 4 are both less than n , we can apply the induction hypothesis, giving T ( n ) c n 5 + c 3 n 4 + n = cn 1 5 + 3 4 + n = cn 19 20 + n = n 19 c 20 + 1 . This last expression will be cn , provided that we select c such that c (19 c/ 20) + 1 . Solving for c we see that this is true provided that c 20 . Combining the constraints that c 1 , and c 20 , we see that by letting c = 20 , we are done. A natural question is why did we pick groups of 5? If you look at the proof above, you will see that it works for any value that is strictly greater than 4. (You might try it replacing the 5 with 3, 4, or 6 and see what happens.) Lecture 10: Long Integer Multiplication (Thursday, Feb 26, 1998) Read: Todays material on integer multiplication is not covered in CLR. Office hours: The TA, Kyongil, will have extra office hours on Monday before the midterm, from 1:002:00. Ill have office hours from 2:004:00 on Monday. Long Integer Multiplication: The following little algorithm shows a bit more about the surprising applica tions of divideandconquer. The problem that we want to consider is how to perform arithmetic on long integers, and multiplication in particular. The reason for doing arithmetic on long numbers stems from cryptography. Most techniques for encryption are based on numbertheoretic techniques. For example, the character string to be encrypted is converted into a sequence of numbers, and encryption keys are stored as long integers. Efficient encryption and decryption depends on being able to perform arithmetic on long numbers, typically containing hundreds of digits. Addition and subtraction on large numbers is relatively easy. If n is the number of digits, then these algorithms run in ( n ) time. (Go back and analyze your solution to the problem on Homework 1). But the standard algorithm for multiplication runs in ( n 2 ) time, which can be quite costly when lots of long multiplications are needed. This raises the question of whether there is a more efficient way to multiply two very large numbers. It would seem surprising if there were, since for centuries people have used the same algorithm that we all learn in grade school. In fact, we will see that it is possible. DivideandConquer Algorithm: We know the basic gradeschool algorithm for multiplication. We nor mally think of this algorithm as applying on a digitbydigit basis, but if we partition an n digit number into two super digits with roughly n/ 2 each into longer sequences, the same multiplication rule still applies....
View
Full
Document
This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.
 Fall '11
 Staff

Click to edit the document details