{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# t4 - 7 board with any one square missing can be tiled using...

This preview shows page 1. Sign up to view the full content.

CS3230 Tutorial 4 1. In counting sort, we did the copying from array A to B by going down from n to 1 (that is copying from the end to the beginning). Write a stable counting sort algorithm which does this by copying from the beginning to the end. 2. Suppose an array A contains n numbers between 1 and m . Write an algorithm with worst case complexity of O ( m + n ), which finds the median element of the array. Note that you cannot use the Select algorithm done in class as that has worst case complexity of O ( n 2 ). 3. In merge sort algorithm done in class, for merging two arrays of size m and n respectively, we used one extra array of size m + n . Can you give an algorithm to do the merge which uses an extra array B of size only min( m, n )? Complexity of your algorithm should still be linear in the size of the two arrays. 4. (a) Show that any board of size 2 j × 3 j (without any missing squares) can be tiled using trominoes. (b) Show that a 5 × 5 board, with a corner missing, can be tiled using trominos. (c) Show that any 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 7 board with any one square missing can be tiled using trominos. (This is lengthy, and done by considering several possible cases of missing square. So if you can’t ﬁnd an answer just assume that this can be done). (d) Show that a 11 × 11 board, with any one square missing can be tiled using trominos. Hint: Divide the board into a sub-board of size 7 × 7 (which contains that missing square), a sub-board of size 5 × 5 with a corner missing, and two sub-boards of size 4 × 6. (e) By induction show that, for n > 11, any n × n board with one square missing can be tiled using trominoes as long as n is odd and not a multiple of 3. Hint: Divide the board into four parts, One of size ( n-m ) × ( n-m ) containing the missing square (which can be solved using induction), two boards of sizes ( n-m-1) × m , which can be solved using part (a), and one board of size ( m +1) × ( m +1), with a missing corner. 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online