Question

1. Let A = {a1, ..., an} and B = {b1, ..., bm} be two sets...

1. Let A = {a1, ..., an} and B = {b1, ..., bm} be two sets of numbers. Consider the problem of finding their intersection, i.e., the set C of all the numbers that are in both A and B.

a. Design a presorting based algorithm for solving this problem and determine its efficiency class.

2. Estimate how many searches will be needed to justify time spent on presorting an array of 103 elements if sorting is done by mergesort and searching is done by binary search.

3. Solve the following system by Gaussian elimination:

x1 + x2 + x3 = 2

2x1 + x2 + x3 = 3

x1 - x2 + 3x3 = 8

4. Solve the system of problem #3 by computing the inverse of its coefficient matrix and then multiplying it by the vector on the right-hand side.

5. For each of the following lists, construct an AVL tree by inserting their elements successively, starting with the empty tree.

a. 1, 2, 3, 4, 5, 6

b. 6, 5, 4, 3, 2, 1

c. 3, 6, 5, 1, 2, 4

6. Construct a heap for the list 1, 8, 6, 5, 3, 7, 4 by the bottom-up algorithm.

7. Construct a heap for the list 1, 8, 6, 5, 3, 7, 4 by successive key insertions (top-down algorithm).

8. Apply Horner's rule to evaluate the polynomial

p(x) = 3x4 - x3 + 2x + 5 at x = -2.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

DATE -List and then n Single sort hat list After the (ompares the peiYs 汗5 Consecutive elements.cxdd Common ualu es toClist c

31/ Given eavations aly 2. рез 8 3 co elic eint So auaented maty

2 3 AM=12 I 2. 2 O O L 2+ 久2 =-/ナ2

IDATE 21-3-2 っe \ =

-2 lerccedes the hight -so-first DCI otahiom of to mke it 2. 3 nset 2 2 make rotLCa) ho make hight bclanets e

DATE 2 2. 4 ㄐ 3 3 mak e rotation of C2) to spakeit aur inau AVL ree fem a is 2 3

6 5 5 4 balance-to-ee rnake -to-make-is 5 6 3 odlance A

DATE 5 3 2 4 2 3 2 6

2. 2 (3 3 6 6) 弋 4o et balanced 32-et 3 (6

PAGE No. DATE 2. balanced AVL ee asfelloos 32 2 Ls 6venlist heap fen algorithm -. CIS--fo ( 1 o aos given list bi bo ttom V 6 5 3 7 4 Iy ) 8 7 5 3 6 Staiven heap top-docen cugorithm 3 6 3573 6 4 here new element insered in hean S_ S hous n b (一) underlined Palt nomic is Solve

Add a comment
Know the answer?
Add Answer to:
1. Let A = {a1, ..., an} and B = {b1, ..., bm} be two sets...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT