241HW3Pb3
Xin Yan
435557
3.
(a)
acta
gaac
ctag
aagc
tcat
gcgt
ttct
Sort this list into lexicographic order with a radix sort that operates on the last string
position at a time.
acta
gaac
aagc
ctag
tcat
gcgt
ttct
Sort this list into lexicographic o
CSE 241 Algorithms and Data Structures
Solutions to Practice Problems for Homework 4
1. Recall that A = w, m, q, k, f, p, b, a, c, d, b, k, g .
w m k f c d b k p g q b
(a)
a
w m k
(b)
v f p b k g b q
a
c
d
v m k
(c)
q f p b
v
b g
a
c
d
k
k g
(d)
q f p b k
CSE 241 Algorithms and Data Structures
Solutions to Practice Problems for Homework 6 and Final
In the problems in which you are asked to give a bfs, dfs, or shortest path tree, instead of drawing it graphically, I will just list the parent pointer for eac
CSE 241 Algorithms and Data Structures
Fall Semester, 2007
Solutions to Practice Problems for Homework 2
1. First the median between 15, 8, and 3 is computed, and swapped into the last element of the subarray, leading to the array: 15, 7, 9, 3, 4, 10, 8 .
CSE 241 Algorithms and Data Structures
Solutions to Practice Problems for Homework 3
1. Suppose you are given the task to sort one thousand 32-bit keys. You have decided to use radix sort for this problem and want to decide how many bits each radix sort d
241HW3Pb1
Xin Yan
435557
1.
(a)
A=cfw_3, 9, 2, 7, 1, 6, 4, 5
5 is the pivot and set i=-1, j=0.
(1)
Compare A[j] with pivot: 3<5
Then i+ swap A[i] and A[j]
Then j+
A=cfw_3, 9, 2, 7, 1, 6, 4, 5
(2)
Compare A[j] with pivot: 9>5
Then do nothing.
Then j
Xin Yan
435557
HW2Pb5
5.
(a)
When k=0, theres 2! = 1 .
When k=1, therere 2! = 2 .
When k=2, therere 2! = 4 .
When k=3, therere 2! = 8.
Suppose k=n, then therere 2! ,
Assume k=n+1, then there are2! 2=2! = 2! .
That is to say, the final number of slo
Pb5
Xin Yan
435557
5.
(a)
A single node with k keys requires 3k + 4(k + 1) + 4 bytes, since it has k + 1 child
pointers and (per the problem statement) 4 bytes of additional information. To fit this
node into 4096 bytes, we need 7k+8 4096, k584
To
Pb3
Xin Yan
435557
3.
(a)
(b)
For the insertion of 13: at level 3 we inspect INF
at level 2 we inspect 4 and INF
at level 1 we inspect INF
at level 0 we inspect 6 and INF
For the insertion of 9: at level 3 we inspect INF
at level 2 we inspect 4 and
Pb4
Xin Yan
435557
4.
(a)
Assume there are n nodes with the largest pillar height h. The link between the head
node and the node with the highest pillar skips at least one node. Also the link
between the tail node and the node with the highest pill
Pb1
Xin Yan
435557
1.
(a)
A[0]<B[0]?
No
Yes
A[1]<B[0]?
B[1]<A[0]?
A[1]<B[1]?
a0a1b0b1
a0b0a1b1
B[1]<A[1]?
b0b1a0a1
a0b0b1a1
b0a0b1a1
b0a0a1b1
(b)
The merged array has length 2n. Exactly n of these positions come f
CSE 241 Algorithms and Data Structures
Fall Semester 2015
Homework 1
Assigned: 8/31/2015
Due Date: 9/16/2015
This homework must be completed and submitted electronically. Formatting standards, submission
procedures, and (optional) document templates for h
ConcePh/xml View (4)09 FjijJlE/V/VU/y>
Mc-HoJ,$ IJCdim LS
Ma ak!) loCaql/SC/LYCLD rCVVlDVB
' / mm M W a.
$42, VVVtY In 0X y
° \ M SuaCSSOV m (oz SuccchoFCK) [5 r
:Dt X>NACWW M 6* Prdcccssor (Ls) .J j
SV PDQ ach m [aqrdhw'ic 1 ""5 V
$x2c 2 P00 S ZC 4