Question

1. Given a set of numbers: A = {1, 3, 5, 2, 8, 7, 9, 4...

1. Given a set of numbers: A = {1, 3, 5, 2, 8, 7, 9, 4 }.

Add each digit of your N-Number (e.g. N0 0 3 2 2 0 1 8) to each element of A

separately to get your own final array B. ( e.g. B={1,3,8,4,10,7,10,12} = {B1,B2,B3,B4,B5,B6,B7,B8}. )

a) Your set B = ?

b) Use merge-sort to sort the array B. Show each step.

c) How many “comparisons” for each algorithm above?

2. Use binary-search for finding the number 6 for the sorted array based on Question 1, show each step. (6 might not be in your sorted array.)

3. The time complexity equation of merger-sort is T(n) = 2* T(n/2) + n, where T(1) = C and C is a constant. Solve this equation by giving detailed steps. (Hint: See lecture notes).

4. How do we use linked-lists to represent adjacency-lists in a graph? Provide an example including at least 6 vertices and 8 edges.

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

1. A:1 3.5.2.8.7.9.0} | lat Us {o.1,21,0,0,1,2} | a) | 。 - {1,0,73,8 LL, 10,6 [urs all lol ill Lo 6 01 3 lo 白白向自西向立 11 6 ( 3c

1. 2. In sorting a shows the number of compare- Son at that step. val no. of comparisons - Ild+1+1/3+370 - 15 Array B= {1, 3

after k function calls, fin నందం T(n) = 2 + ) + (n +n un to---k times) @ T(n) = 2*T (2/2) + kn - for 2 / 2 o ka logan By subs

IS A rayfoorsday + - Rorovo/pro H ISS FIT 1 / Ft FTT FIF Is | 기 FTFITF 7) Ft F | [DIY ETFT- [ ELES FTS E To | |

If you're still having any doubt then please feel free to ask in the comment section.

Add a comment
Know the answer?
Add Answer to:
1. Given a set of numbers: A = {1, 3, 5, 2, 8, 7, 9, 4...
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
  • Year 2015 2016 2017 5 Exp Return 6 Std Dev 7 Covariance 8 Correlation Stock 1...

    Year 2015 2016 2017 5 Exp Return 6 Std Dev 7 Covariance 8 Correlation Stock 1 13.00% 17.00% 8.00% 12.67% 3.68% 0.002411 Stock 2 -7.00% 14.00% -3.00% 1.33% 9.10% Which formula/function is the correct one to calculate the correlation in B8? =CORREL(B2:B4,C2:C4) All of the above =B7/(16*C6) =((B2-B5)*(C2-C5)+(B3-B5)*(C3-C5)+(B4-B5)*(C4-C5))/(B6*C6*COUNT(A2:44))

  • 1. part 2 Part 3 File Home Insert Page Layout Formulas Data Rei Arial 12 A...

    1. part 2 Part 3 File Home Insert Page Layout Formulas Data Rei Arial 12 A A X Cut LECopy Format Painter Paste BIU. A 1.1.1 Clipboard Г Font : с A Year B Cash Inflows (Outflows) 1 1 2 0 3 4 2 5 3 6 4 7 5 8 9 Annual discount rate 10 Net present value 11 Internal rate of return ($200,000) $40,000 $80,000 $38,000 $50,000 $58,000 8.00% $12,015.09 10.23% Applying Excel 8: Calculating internal rate of...

  • B А 1 Next Dividend (D.) 2 Dividend Growth Rate 3 Stock Price 4 Flotation Cost...

    B А 1 Next Dividend (D.) 2 Dividend Growth Rate 3 Stock Price 4 Flotation Cost 5 Beta 6 Risk-free Rate 7 Expected Market Return 8 Cost of New Common Equity 2.25 4.00% $35.00 6.00% 1.15 2.50% 9.00% ? What is the correct formula for B7 to find the cost of new common equity using the constant growth dividend discount model? =B1/B3*(1-B4))+B2 =B1/(B3"(1-B4))+B2 B5+B4 B6 -B1/B3+B2

  • Please help me answer questions 3,4 & 5. 2. What is the correct value for the...

    Please help me answer questions 3,4 & 5. 2. What is the correct value for the after- tax salvage cash flow in B4? a-2,800 b) 47,800 c) 27,000 d) 42,200 e) 45,000 1 Salvage Value 2 Book Value 3 Tax Rate 4 After-Tax Salvage Value 45,000 52,000 40% 40%(81-82) = 2850s → ស 3. What is the value of cell B7? a) 1.80 b) 2.17 c) 2.32 d) 2.50 e) 2.73 Year Cash Flows (60,000) 20,000 25,000 30,000 6 WACC...

  • Reverse of a digraph 30 Marks For a given set of digraphs, write a program that prints out the reverse of each digraph. Input format: described below under the heading “Digraph input format”. Note th...

    Reverse of a digraph 30 Marks For a given set of digraphs, write a program that prints out the reverse of each digraph. Input format: described below under the heading “Digraph input format”. Note that adjacency lists are sorted. Output format: use the input format to output your result ensuring that the output adjacency lists are sorted. the input format: 4 1. 3 2. 3 0 3 1. 2 1 0 2. Reverse of a digraph 30 Marks For a...

  • B3 and B8 ers/ahmedkhamis/Downloads/CMCE1115%20Project 1 Spring2020%20(2).pdf 825 W8X15 +PRI ELEVATOR W10X22 WAXOIM W10X22 B12 B18 B21...

    B3 and B8 ers/ahmedkhamis/Downloads/CMCE1115%20Project 1 Spring2020%20(2).pdf 825 W8X15 +PRI ELEVATOR W10X22 WAXOIM W10X22 B12 B18 B21 W10X22 - TELL AT FITS HEH G3. BRI - - W1pX26- G . W12X26 12X35 shar 6-11 1/2 5-31/2 B2 W12x26 B1 W12X26 83 W12x26 B4 W12/26 W12X26 B6 W12X26 B7 W12X26 B8 W12X26 B9 W12X26 011 UUUUUU 2. Calculate and show Tributary width and tributary area for each assigned beam 3. Free body diagram for each beam 4. Calculate the reactions for assigned...

  • 1. a. Using C++, represent the following graph using adjacency matrix, and implement depth first searching...

    1. a. Using C++, represent the following graph using adjacency matrix, and implement depth first searching (DFS) by stack (define it with class) to traverse the graph. 6 7 2 4 b. If starting with node 2, when node 7 is printed, what numbers are in the stack (for DFS)? Please draw the stack step by step to show how the numbers are pushed into and popped out of it. 2. a. Given a set of integer numbers as int...

  • Assume that the following 8 numbers are elements of an array (7pt). 8, 7, 6, 5,...

    Assume that the following 8 numbers are elements of an array (7pt). 8, 7, 6, 5, 4, 3, 2, 1. Sort the array in ascending order by applying Merge sort, and show how the array looks after each step. Is merge sort has every-case time complexity? If your answer is yes, what is its every-case time complexity? If your answer is no, what is its worst case time complexity and at what condition it will have worst-case time complexity? If...

  • Introduction BUBBLE SORT: Step-by-step example Let us take the array of numbers "5 1 4 2...

    Introduction BUBBLE SORT: Step-by-step example Let us take the array of numbers "5 1 4 2 8", and sort the array from lowest number to greatest number using bubble sort. In each step, elements written in bold are being compared. Three passes will be required First Pass: ( 5 1 4 2 8 ) → ( 1 5 4 2 8 ). Here, algorithm compares the first two elements, swaps since 5 (15428)→(14528). Swap since 5 > 4 (14528)→(14258). Swap...

  • In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2...

    In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2 8 11 4 1 For the matrix A in problem-2, use MATLAB to carry out the following instructions a. Find the maximum and minimum values in each column. b. Find the maximum and minimum values in each row. c. Sort each column in ascending order and store the result in an array P. d. Sort each row in descending order and store the result...

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