{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MIT6_851S10_assn07

# MIT6_851S10_assn07 - (c Describe how to compute the most...

This preview shows pages 1–2. Sign up to view the full content.

6.851 Advanced Data Structures (Spring’10) Prof. Erik Demaine Dr. Andr´ e Schulz TA: Aleksandar Zlateski Problem 7 Due: Thursday, Apr. 1 Be sure to read the instructions on the assignments section of the class web page. Finding the most signifcant 1 bit. Several times in lecture, we’ve needed the operation of Fnding the bit position (index) of the most signiFcant 1 bit in a word x . This is equivalent to computing lg x ± . In this problem, you’ll solve this problem in constant time using a word RAM with standard C operations on integers ( + , - , * , / , % , , | , ~ , ^ , << , >> ). (a) Suppose we divide a w -bit word into w chunks, each b = w bits long. Describe how to compute in O (1) time a word that replaces each chunk with either 0 b if the chunk is all 0s, or 10 b 1 if the chunk has a 1. 1 (b) Prove that you can compress the chunk summary computed in part (a) down to b consecutive bits, preserving their order. (Hint: multiply, mask, shift.)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (c) Describe how to compute the most signiFcant 1 bit in the chunk summary word computed in part (b). (Hint: Use a static fusion-tree node. But take care not to rely on Fnding the most signiFcant 1 bit.) (d) Describe how to compute the most signiFcant 1 bit in the most signiFcant chunk with a 1 in it, and thus compute the overall most signiFcant 1 bit. Here k denotes repeated k times. 1 1 MIT OpenCourseWare http://ocw.mit.edu 6.851 Advanced Data Structures Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms ....
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

MIT6_851S10_assn07 - (c Describe how to compute the most...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online