DOC PREVIEW
UMD CMSC 878R - Homework #7

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Homework 7 (Data Structures)Create a library of functions that enable you to work with hierarchical data on a 2d- tree. Your program should atleast be able to handle the cases d = 1,2. (It is relatively straightforward to create a library, which takes d as an inputparameter).The library must contain the following functionsBit interleaving/deinterleaving:n = Interleave(N), {n is the box index in the 2d-tree, N is the vector of length d(integer Cartesian coordinates of n, Nk= 0, 1, ..., k = 1, ..., d)},N = Deinterleave(n), {the same as above}.Functions that require constant time O(1) :m = P arent(n), {n is the box index, m is the parent index},Ch = ChildrenAll(n), {n is the box index, Ch is the array of children box indexes},Sb = SiblingsAll(n), {n is the box index, Sb is the array of sibling box indexes},Nei = NeighborsAll(n, l), {n is the box index at level l,Nei is the array of neighbor box indexes},NeiE4 = NeighborsE4All(n, l), {n is the box index at level l, NeiE4 isthe array of box indexes at the same level that belong to the E4-neighborhood},n = BoxIndex(x,l), {x is the point coordinate in a unit cube,n is the index of box at level l containing x},x = BoxCenter(n,l), {n is the box index at level l, x is the point coordinate in a unit cube},s = BoxSize(l), {l is level, s is the size of the box at this level}.Functions that require time O(log N )These functions will need to use the function find. The term non-empty means that the box contains at least one pointof the sorted data set XCh = Children(n, l, X), {n is the box index, Ch is the array of nonempty children box indexes},Sb = Siblings(n, l, X), {n is the box index, Sb is the array of nonempty sibling box indexes},Nei = Neighbors(n, l, X), {n is the box index at level l,Nei is the array of nonempty neighbor box indexes},NeiE4 = NeighborsE4(n, l, X), {n is the box index at level l,NeiE4 is the array of nonempty box indexes at the same level that belong to the E4-neighborhood},1Function that requires O(N ) time:L = GetMaxLevel(s, X), {X is sorted data array, L is the space subdivision levelat which each box contains not more than s points};You also may write a function SetDataStructure(s, X) (that requires O(Nl ogN) time) which will be useful for yourfurther work. It takes initial array X and grouping parameter s, then orders the array, obtains its permutation index,determines max level of subdivision and creates nesessary data for your bookkeeping.Questions1. Learn the following Matlab functions (use help): bitmax, bitand, bitor, bitxor, bitcmp, bitshift,bitset, bitget; sort, find, union, intersect, difference, setxor;2. Implement these functions using bitwise operations in Matlab;3. Make tests and check if your programs work correctly (take some small level and data set of small length tocheck this manually).4. Print out and submit the following results for 1-d case: Parent(1025), ChildrenAll(1025), SiblingsAll(1025),NeighborsAll(1025, l), NeighborsE4All(1025, l),BoxIndex(0.1234567, l), BoxCenter(1025, l), BoxSize(15), where l = 12 for d = 1 and l = 6 for d = 2.5. Generate a data set X that contains 2000 numbers equispaced in [0,0.9995]. Print out and submit the followingresults for 1-d caseChildren(1025, 12, X), Siblings(1025, 12, X), Neighbors(1025, 12, X),NeighborsE4(1025, 12, X).6. Print out and submit for this X result of call GetM axLevel(7, X).7. Generate a data set X that contains 10000 numbers equispaced in [0,0.99]×[0,0.99]. Print out and submit the fol-lowing results for 2-d case Children(1025, 6, X), Siblings(1025, 6, X), Neighbors(1025, 6, X), NeighborsE4(1025, 6, X).8. Print out and submit for this X result of call GetMaxLevel(7, X).Hints1. For debugging and tests try first to draw on a paper a picture which tells you what numbers you should


View Full Document

UMD CMSC 878R - Homework #7

Download Homework #7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework #7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework #7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?