tutorbin

design and analysis of algorithms homework help

Boost your journey with 24/7 access to skilled experts, offering unmatched design and analysis of algorithms homework help

tutorbin

Trusted by 1.1 M+ Happy Students

WhatsApp Support

Get Instant
Online Homework Help
via WhatsApp

Get instant homework help from top tutors—just a WhatsApp message away. 24/7 hw help support for all your academic needs!

A
S
M
R
★★★★★
2M+ students trust TutorBin
Your WhatsApp Number
phone
or
⚡ Instant reply
🔒 100% private
👨‍🏫 Top tutors
🌍 All subjects
*Get instant homework help from top tutors—just a WhatsApp message away. 24/7 support for all your academic needs!
2M+ Students Helped24/7 Live SupportExpert TutorsAll Subjects CoveredInstant Response100% ConfidentialTop Rated ServiceMoney-back Guarantee2M+ Students Helped24/7 Live SupportExpert TutorsAll Subjects CoveredInstant Response100% ConfidentialTop Rated ServiceMoney-back Guarantee

Recently Asked design and analysis of algorithms Questions

Expert help when you need it
  • Q1:American Sharjah * 1997 CMP 340 - Design and Analysis of Algorithms Assignment #2 : Divide & Conquer Deadline : March 5th, 2024 The path length of a binary tree is defined as the sum of the lengths of all the paths that connect the root with every node in the tree. For example, the path length for the following is 14: A B F E C G H D Design a divide and conquer algorithm for finding the path length of an arbitrary binary tree. Find the complexity of the algorithm. Deliverables: submit your work by e-mail (zip and attach all relevant files) to gbarlas@aus.edu. Name your file using your ID and the number of the assignment, e.g. 3648_ass2.zip You may work individually or in teams of two. Use both IDs in naming the file in the latter case. UniversitySee Answer
  • Q2: Spring 2024 Type Name: CSC175 Assignment 6 Directions: Download this file and save as lastnameAssignment6SP24. Type all solutions on this document. Upload Word document to Blackboard by! . Show work and explain concepts thoroughly! Note: Recall that A[1] refers to the first element of the list A, A[2] is the second, etc. [3] points for a professional looking document (organization, neatness, etc.) 1) [6] Use the Euclidean Algorithm to find: (show each step of the algorithm) a) GDC(693,600) b) GCD(1260,125) 2) Consider the sorted list: 11 17 18 21 23 27 28 29 33 40 41 52 57 a) [1] What is the most steps it could take to find a number if we traveled through the list one at a time? Why? b) [2] What is the most steps it could take to find a number if we traveled through the list using binary search? Why? c) [5] Use binary search to find 27. Explain how you used the algorithm at each step. 3) a) [2] Give the Big O runtime for the following algorithm. Explain your answer. Begin FunAlgorithm (List of numbers A) Enter N (length of A) print N " is the length of A." M=N*4 print M " is a multiple of 4." If N<7 then print "A has less than 7 elements." Else if N>9 print "A has more than 9 elements." Else print "A has between 7 and 9 elements, inclusive." W = A[N-1]*5 print W" is a multiple of 5." print "Algorithms are fun!" End FunAlgorithm b) [5] For the FunAlgorithm above, what would the output be if A = (3, 44, 23, 4, 69, 223, 14, 4, 21, 34, 52)? c) [2] Give the Big O runtime for the following algorithm. Explain your answer. Begin Find28Algorithm (List A of unsorted numbers which includes the number 28) Enter N (length of A) Conduct Insertion Sort on A Conduct Binary Search on A to find the number 28 End Find28Algorithm d) [2] How would the Big O runtime change for Find28Algorithm if A was sorted? e) [2] Give the Big O runtime for the following algorithm. Explain your answer. Begin TwoDigitsAlgorithm (List A of integers) Enter N (length of A) print N " is the length of the list A." For i = 1 to N-1 For j =i+1 to N If A[i]=A[j] print A[i] End If End For End For For k = 1 to N If A[k]<10 or A[k]>99 print A[k] " is not a two-digit integer." End If End For End TwoDigitsAlgorithm f) [2] What is TwoDigitsAlgorithm doing? Be as clear as possible. g) [3] For TwoDigitsAlgorithm above, what would the output be if A = (44, 23, 4, 69, 223, 44, 4, 21, 34, 52)? 4) Consider the list 16 8 12 23 6 10 25 19 20 a) [5] Use bubble sort to sort the list. Show each swap. How many swaps took place? b) [7] Explain how merge sort works in your own words. Use merge sort to sort the list. Show each step. c) [7] Explain how insertion sort works in your own words. Use insertion sort to sort the list. Show each step. 5) [6] Answer each question. a) What is the best case runtime for Quicksort? When does that occur? b) What is the worst case runtime for Quicksort? When does that occur? c) What is Big O notation for merge sort? Generally does it differ from best to worst case runtime? Why do you think that is the case?See Answer
  • Q3:3. Consider Shell sort where we apply insertion sort to k subarrays (or columns) for k = 3 and k = 2. For a particular k, we say that the array is k-sorted if each of the k subarrays, as obtained/defined in the context of Shell sort, is sorted properly. The 1-th subarray, with 0≤1≤k-1, contains the elements A[1], A[1+k], ... assuming that A is the unsorted array, and the starting index is 0. Consider k = 3 and k =2. Shell sort will sort the array by first applying insertion sort to k = 3 subarrays, followed by applying insertion sort to k = 2 subarrays. It turns out that the resulted 2- sorted array is still 3-sorted. In other words, if we subdivide the 2-sorted array into k = 3 subarrays (according to the definition of subarrays in the context of Shell sort), each of the k = 3 subarrays is still sorted. Justify that now, each element in the array is at most one position off its correct position. (Hint: Consider an element at position i in an array that has been 3-sorted and 2-sorted. What can you say about the relation between this element and the element at position i+2, i+3, i +4, ...?) (Now, a more challenging problem: argue that after applying insertion sort to k = 3 subarrays and then to k = 2 subarrays, the array is both 3-sorted and 2-sorted. This challenge problem is not part of this homework.)See Answer
  • Q4:2. Consider the following procedure that generates a sequence of integers that could be used for Shell sorting n ≥ 0 elements. The integers in the sequence used for Shell sorting are assigned to the variable k. Generate Sequence (n) k + 1; P + 1; while (kn) { 01. 02. 03. 04. 05. 06. kk x 2 + 1; P + P + 1; } /* end of while (k <n) */ (a) What are the integers assigned to k's in lines 01-06 when the following values of n are passed into the function? Write down each sequence of integers assigned to k in the order in which they are assigned. • n = 1: • n = 4: • n = 10: • n = 30: (b) There is a closed-form formula for the integers assigned to k's in lines 01-06: k=2P-1. For lines 01-05, write down the expression for the number of times each of the instructions is executed in terms of n. You may have to use the ceiling or the floor function. Given a real number, x, the ceiling of x, denoted as [x] is the smallest integer that is not less than x. The floor of x, denoted as [x] is the largest integer that is not greater than x. In other words, [x] ≤x≤ [x].See Answer
  • Q5: Question 4 (25 marks) This question focuses on Part 4 (repetition), Part 5 (components) and Part 6 (sorting). The teacher runs an after-school computing club and stores the names of children who belong to this club in a list, which at present is unsorted. Another school close by would like to offer a computer club, but does not have suitable facilities. However, the two schools have reached an agreement allowing children from the second school to attend the computer club run by the first. The second school has supplied a list, again unsorted, of the names of children from that school who want to belong to the club. ធ The teacher who runs the club now wants a program that will take the two lists and combine them to eventually produce a single sorted list containing the names of all the children, from both schools, who belong to the club. She is considering two possible strategies for producing this list. Strategy 1. Append the second school's unsorted list to the end of the first school's unsorted list, then sort the combined list. Strategy 2. Sort the two lists separately, then combine the sorted lists in a way that results in a single sorted list. The teacher is interested in exploring how many comparisons between names each sorting strategy uses and which of the two requires the fewer comparisons. She has begun writing a program to investigate these questions and has enlisted you to help her complete it and use it to run some experiments. For simplicity, we will only use the children's first names and assume no two names are the same. Open the project TM111_02_04. sb2. It contains three lists: • school_1 and school_2, which contain the two unsorted lists from the first and second schools, respectively • merged, which is empty at present; this will hold the final sorted list. There are also four variables, as follows (the meaning of 'swapping pass' will be described when we come to it): • pass, used to keep track of swapping passes position, used to keep track of the current position in a swapping pass • temp. used when swapping two adjacent elements • compartson_count, used to count how many pairs of adjacent elements are compared, during sorting and the subsequent merge operation. In addition there are two components, the custom blocks swapping_pass_1 and swapping_pass_2, and a when[1]key_pressed script. The purpose of these will now be explained. Note that there is no need for you to modify either of the custom blocks and you should not attempt to do so. a. The swapping_pass_1 component and the when [1]key_pressed script together form an implementation of bubble sort 2, as discussed in Subsection 6.4.2 of Block 2 Part 6. The list they will sort is school_1. In a bubble sort we perform a series of swapping passes, where each swapping pass consists of working our way through the list to be sorted, comparing pairs of adjacent items, and swapping any pair that is out of order. Each swapping pass causes an item to 'bubble up' and stop at its correct position in the sorted list and so after each swapping pass the unsorted portion of the list becomes one item shorter. Since a swapping pass only needs to consider the unsorted portion, each pass can be one comparison shorter than the previous one. This is illustrated in Figures 6.34 to 6.37 of Subsection 6.4.2, where we observe that bubble sort 2 will require approximately (n-1)2/2 comparisons, where n is the number of items. It is not too hard to show (but we will just assume this result) that the exact number is n x (n-1)/2. Make sure the watcher for comparison_count is visible on the stage, then press the 1 key to execute the when [1] key_pressed script. You should now see that the school_1 list is sorted, and 66 comparisons were needed. This is the expected number: the length of the list is 12 and 12 x 11 / 2 = 66. Now create a when [2]key_pressed that will result in the school_2 list being sorted. You can do this by copying the when [1]key_pressed script and carefully making the necessary changes. i. Take a screenshot of your when [2]key_pressed script and paste it into your TMA document. ii. Make sure the watcher for comparison_count is visible on the stage, then run your when [2]key_pressed script and note how many comparisons were required. Explain what number you were expecting and why, and state whether the result of running the script agrees with your calculation. Note that you can repopulate the lists for the first and second schools, whenever required using the provided files school_1.txt and school_2.txt and following the procedure described on page 69 of Block 2, Book B. Part 4. (5 marks) b. Next you will write a script to merge the two sorted lists. The idea behind the merging algorithm is that we repeatedly compare the item at the front of the first list with the item at the front of the second list: whichever is the smaller is added to the merged list, then removed from its original list. At some point, one list will become empty and we can then simply append the contents of the other list to the merged list. The steps of the algorithm are as follows, including the steps that are there to count the number of times two items are compared. Empty the merged list Initialise comparison_count to O Repeat until length of list school is oor length of list school 2 is 0 Increase comparison_count by I If item I of school is alphabetically before item I of school_2 Add item I of school to merged Remove this item from school else else Add item I of school 2 to merged Remove this item from school_2 If length of school is o Repeat until length of school_2 is 0 Add item of school 2 to merged Remove this item from school 2 Repeat until length of school is o Add item I of school to merged Remove this item from school 1. Take a screenshot of your complete when [m]key_pressed script and paste it into your TMA document. ii. Run your when [m]key_pressed script and note how many comparisons were required. Add this number to the numbers of comparisons that were required to sort the individual lists in part (a), to get the total number of comparisons taken to generate the final sorted list of children from both schools. iii. Suppose that instead of following Strategy 2 (sorting the lists then merging the results) we had instead used Strategy 1 (appending the second list to the first and then sorting the combined list using bubble sort 2). Use the formula given earlier to calculate how many comparisons would have been needed and briefly comment on which of the two strategies seems to be the most efficient in this example. (15 marks) c. In this part, you will look at some further examples of how Strategy 2 performs compared to Strategy 1. 1. Merging two lists of length m and n respectively never needs more than m + n-1 comparisons. This is because each comparison results in an item being moved to the merged list. If there are m + n items altogether then if we ever got to m + n-1 comparisons it would mean we had moved all but one of the items to the merged list and the final item could be moved without any comparison. This is the worst case; in general we are likely to need fewer than m + n-1 comparisons. Suppose the first list contained 18 items and the second list contained 5 items. How many comparisons would Strategy 1 take to sort a combined list of 23 items? Considering Strategy 2, what is the greatest number of comparisons it could take to bubble sort the first and second lists individually, then merge the results? Comment briefly on the difference in performance. ii. Is Strategy 2 always an improvement on Strategy 1? Consider an extreme case. Suppose the first list has only 1 item and the second list has 18 items. Following the same method as in part (1) above, calculate the maximum number of comparisons required by each strategy and comment briefly on what you find. (5 marks) • • Save your OUBuild project for Question 4 and submit it as TM111_02_04_PI. sb2 (where Pl is your OU personal identifier, e.g. A1234567) in your TMA zip file. Alternatively, you may use your OUCU instead of your Pl.See Answer
  • Q6: Question 1 (20 marks) □ This question focuses on Part 1 (variables), Part 2 (constants, lists, arithmetic and joining strings) and Part 3 (selection) Open the project TM111_02_01.sb2 This project is intended to implement a program to help the teacher record how many paintings pupils have completed during the school term, up to a maximum of 25 paintings. Before recording the number of paintings completed by each pupil, the teacher will start the program using the green flag. She will then press her space key whenever she wants to record a pupil's number of paintings, which she will enter out of a maximum of 25. If the number, as a percentage of the maximum of 25, is more than 80%, then the pupil will be awarded a Renoir sticker. In this project, we have provided a when_green_flag_clicked script and a when[space]key_pressed script. Consider these scripts carefully and then answer the questions below. a. Complete the step-by-step description below of what the when[space]key_pressed script does when the user starts the program using the green flag, then presses the space key, and enters "Rowan', and then 22. The user is asked to enter a pupil's name. Their input. Rowan', is stored in the variable name The user is asked to enter the number of paintings completed by the pupil out of a maximum of 25. Your description should make clear what data is stored in the variables and the list involved, and the result of any comparison that is made. You should describe what happens in the particular scenario here, with the inputs Rowan' and 22, not what the script does in general or what might have happened with different inputs (4 marks) b. 1. Identify a numerical value used in this program that might appropriately be stored in a constant. (Recall that a constant is a value that plays a significant role in a program and does not change during the time the program is running) There may be more than one possibility but you are only required to identify one. You are not asked to implement this constant. (1 mark) IL What might be an appropriate name for the constant you have chosen? (1 mark) c. Amend the when_green_flag_clicked and when [space]key_pressed scripts so that: • If a pupil completes more paintings than 80% of the maximum, their name is added to the list Renoir_list. • Otherwise, their name is added to a list Kahlo_list (which you should create and initialise appropriately). Take a screenshot of your resulting scripts and paste it into your TMA document. c. Amend the when_green_flag_clicked and when [space]key_pressed scripts so that: If a pupil completes more paintings than 80% of the maximum, their name is added to the list Renoir_list. • Otherwise, their name is added to a list Kahlo_list (which you should create and initialise appropriately). Take a screenshot of your resulting scripts and paste it into your TMA document. 2 i. Further amend the when_green_flag_clicked and when [space]key_pressed scripts so that 3 . If a pupil completes more paintings than 80% of the maximum, their name is added to the list Renoir_list. Test number If a pupil completes fewer paintings than 40% of the maximum, their name is added to a list Picasso_list (which you should create and initialise appropriately). • Otherwise, their name is added to the list Kahlo_list. Check that your program passes the following tests. (You aren't expected to give any details of your testing; this is just to help you check your program.) Test purpose Just below lower boundary value Lower boundary value Just above lower boundary value Just below upper boundary value Upper boundary value Just above upper boundary value Test inputs Paintings completed, out of a maximum number of 25 9 10 (equivalent to 40%) 11 19 20 (equivalent to 80%) 21 Name p1 p2 p3 p4 p5 p6 Expected results Name added to list Picasso_list Kahlo_list Kahlo_list Kahlo_list Kahlo_list Renoir_list Take a screenshot of your resulting scripts and paste it into your TMA document. (7 marks) ii. Different forms of selection structure could be used to meet the specification in Q1 (d)(i). Briefly describe an alternative form of selection structure to the one you chose. (2 marks)See Answer
  • Q7:Q2. [5 points] 14. Alternating disks You have a row of 2n disks of two colors, n dark and n light. They alternate: dark, light, dark, light, and so on. You want to get all the dark disks to the right-hand end, and all the light disks to the left-hand end. The only moves you are allowed to make are those which interchange the positions of two neighboring disks. Oox ∞∞∞∞●●●● Design an algorithm for solving this puzzle and determine the number of moves it makes. [Gar99]See Answer
  • Q8:2. 30 points. Let A(x) = x² + 3x - 1 and B(x) = 2x-1. In this question, we will compute the polynomial C(r) = A(r) B(r) by using the FFT algorithm. (a) What is the minimum number of points we need to use? Explain. (b) Evaluate A(z) at the complex 4th roots of unity. Show at least one level of recursion. (c) Evaluate B(x) at the complex 4th roots of unity. Show at least one level of recursion. (d) Compute C(r) at the complex 4th roots of unity. (e) Find the coefficients of C(x).See Answer
  • Q9:Numéro 4. (15 pts) Consider an array t of size n indexed from 1 to n containing integers sorted in ascending order. The array is such that the elements of indices m + 1 to n are all equal to z and Page 4 that t[i]<r for i=1,2,...,m where 1 <m <n. Write an algorithm for finding a value y in the array t, y < r with complexity O(log m) and not O(logn) given that the value of m is unknown. Response:See Answer
  • Q10:Numéro 2. (12 pts) Consider the following pseudo-code function machin (n: natural) return natural begin 1 2 3 4 5 6 7 8 9 10 11 22449 12 13 14 15 sum - 0 x+0 y +0 for k ← 1 to n do y+x+y x+2-1 i+1 while i ≤ 2k do sum sum +i for j+1 to k+ i do sum + sum + j end for i+i+2 end while end for 16 return sum +z-y end machin (a) (6 points) Calculate the exact number of assignments + depending on n performed by the machin function. Don't forget the control variable assignments for each of the loops for (including the last one to exit the loop). Note that calling machin(4) generates 170 assignments. Response: (b) (2 points) Give the number of asymptotic assignments using the notation . Response : (e) (4 points) Determine a barometric operation or instruction to evaluate the asymptotic com- plexity of the function and justify your choice. Give the asymptotic complexity of the function using your barometric operation. Response :See Answer
  • Q11:3. [20 points] For an unsorted array of n integers, show that a) 2n + 3 comparisons are sufficient to find whether any given three integers are in the array. b) 3n+3 comparisons are sufficient to find whether any given four integers are in the array. Describe your algorithm using C-like pseudo code.See Answer
  • Q12:2. [25points] Sort the array A - <27, 18, 4, 5, 22, 95, 35, 11, 17> using the Heapsort algorithm as given in the textbook (CLRS). (a) Show the array after the BUILD-MAX-HEAP is returned. (b) How many comparisons are made by the BUILD-MAX-HEAP? (c) How many comparisons are made in total after the array is sorted? (d) Is an array in increasing order a best case, worst case, or a case in between for the Heapsort? Justify your answer. (e) Use a simple example to show Heapsort is not stable.See Answer
  • Q13:1. [30 points] Sort the array A=<5, 3, 5, 8, 5, 9, 2, 6, 9, 7, 3, 1, 4, 1> using the Quciksort algorithm as given in the textbook (CLRS). (a) Show what the array looks like after the PARTITION is called once. (b) Tell whether the relative positions of any identical keys- e.g., there are three 5's - are changed, after the PARTITION. You may want to mark the identical keys with superscripts to differentiate them, e.g., 5ª, 3ª, 5b, 8, 5º, 9³, 2, 6, 9, 7, 3b, 1ª, 4, 1b. (c) Draw the recursion tree. In the tree, each node, corresponding to a call to the PARTITION, has two boxes: the first one is filled with the input size for partitioning, and the second one is filled with number of comparisons done by the PARTITION. (d) How many times is the PARTITION called? (e) What is the depth of the recursion tree? (f) How many comparisons are made?See Answer
  • Q14:2. Solve the Towers of Hanoi game for the following graph G=(V,E) with V={Start, Aux1, Aux2, Aux3, Aux4, Dest} and E = {(Start,Aux1), (Aux1,Aux2), (Aux2,Aux3), (Aux3,Aux4), (Aux4, Aux1), (Aux3,Dest)}. (a) Design an algorithm and determine the time and space complexities of moving n disks from Start to Dest. (b) Implement this algorithm whereby your program prints out each of the moves of every disk. Show the output for n=1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. (If the output is too long, print out only the first 100 and the last 100 moves.)See Answer
  • Q15:1. Write a program, using your favorite computer (under some operating system that must support VMM) and your favorite programming language, which demonstrates that the timings of matrix addition differ substantially for large enough matrices, depending whether you use Version 1 or Version 2: for i:=1 to n do for j:=1 to n do C[i,j]:=A[i,j]+B[i,j] for j:=1 to n do for i:=1 to n do C[i,j]:=A[i,j]+B[i,j] Version 1 Version 2 Specifically, use this sequence of values for n, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536, and study the timings of both versions. (Be aware that some runs may take longer than you are willing, or able, to wait!) Keep in mind that theoretically the two versions should have the same timings and the doubling the value of n should result in a quadrupling of time spent to do the addition, assuming everything were done in core (which is of course not the case, since the last value corresponds to a memory requirement of about 40 Gigabytes, assuming four bytes per word). Note that you must initialize your matrices A and B but the time required for this should not be part of the measurements. (c++ and python)See Answer
  • Q16:Problem 5 (5 marks, 2 pages). Research a well-known problem of your own interest in any field (science, engineering, technology) that can be solved by a computer algorithm. Write a 1- to 2-page report on a popular algorithm that solves that particular problem and include in your report: (1) a problem description and why it is important and/or interesting, (2) the algorithm description, (3) a pseudocode, (4) a demonstration on a toy example, and (5) a complexity analysis. You could include a few (1-5) references that you used when researching the problem/algorithm, but the writing should be your own. A similarity score of 25% and above between your report and any existing source may indicate plagiarism. The report should be typed in a text editor, e.g., words or Latex, and not handwritten. Marks will be decided based on the correctness, clarity, and the sophistication of the problem/algorithm discussed. A report that is not well written or about a trivial/straightforward problem/algorithm will receive a low mark. Note that the problem/algorithm should NOT be among those already discussed in the pre-recorded lectures/workshops. If you present a problem/algorithm that has been discussed in the lectures/workshops, you will get a zero mark for Problem 5. You could start from our textbook or check the following list from Wiki for a start. https://en.wikipedia.org/wiki/List_of_algorithmsSee Answer
  • Q17:Problem 3. [10 marks, 1.5 pages] (Dijkstra's algorithm + min-heap) Given a graph as in Fig. 1, we are interested in finding the shortest paths from the source a to all other vertices using the Dijkstra's algorithm and a min-heap as a priority queue. Note that a min-heap is the same as a max-heap, except that the key stored at a parent node is required to be smaller than or equal to the keys stored at its two child nodes. In the context of the Dijkstra's algorithm, a node in the min-heap tree has the format v( p., d.), where d, is the length of the current shortest path from the source to v and p, is the second to last node along that part (right before v). For example, c(a, 1) is one such node. We treat d, as the key of Node v in the heap, where v = (a, b, c, d, e, f, g, h}. Source 15 10 Figure 1: An input graph for the Dijkstra's algorithm. Edge weights are given as integers next to the edges. For example, the weight of the edge (a, b) is 7. d(a, 5) a) [1 mark] The min-heap after a(a,0) is removed is given in Fig. 2. The next node to be removed from the heap is c(a, 1). Draw the heap after c(a, 1) has been removed and the tree has been heapified, assuming that ∞ ∞ (note: no need to swap if both parent and children are ∞o). No intermediate steps are required. c(0, 1) ) h(-, ∞) b(a, 7) e(-, ∞) f(-∞) g(-, ∞) Figure 2: The min-heap (priority queue) after a(a,0) has been removed. b) [2 marks] Draw the heap(s) after each neighbour of c has been updated and the tree has been heapified (see the pseudocode in the lecture Slide 30, Week 9). If there are multiple updates then draw multiple heaps, each of which is obtained after one update. Note that neighbours are updated in the alphabetical order, e.g., d must be updated before e. No intermediate steps, i.e., swaps, are required./nS: vertices whose shortest paths have been known 1 a(a,0) 2 a(a,0), c(a, 1) 3 4 5 6 7 8 c) [5 marks] Complete Table 1 with correct answers. You are required to follow strictly the steps in the Dijkstra's algorithm taught in the lecture of Week 9. a b d) [2 marks] Fill Table 2 with the shortest paths AND the corresponding distances from a to ALL other vertices in the format a →? →? →v|d, for instance, a → c | 1. Shortest Paths Distances a → a C d Priority queue of remaining vertices b(a,7), c(a,1), d(a,5), e(−,∞), ƒ (−,∞), g(−,∞), h(−,∞) e f 9 h Table 1: Complete this table for Part c. a → c Table 2: Complete this table for Part d. 0 1See Answer
  • Q18:Exercise 6: Consider an undirected graph. 1. Explain what property of its adjacency matrix indicates that: a) the graph is complete. b) the graph has a loop, i.e., an edge connecting a vertex to itself. c) the graph has an isolated vertex, i.e., a vertex with no edges incident to it. 2. Answer the same questions for the adjacency list representation. ((3+3+3)+(3+3+3))=18See Answer
  • Q19:Exercise 5: 10 Explain how exhaustive search can be applied to the sorting problem and determine the efficiency class (complexity) of such an algorithm.See Answer
  • Q20:Exercise 4: 10 Consider the partition problem: given n positive integers, partition them into two disjoint subsets with the same sum of their elements. (Of course, the problem does not always have a/nsolution.) Design an exhaustive-search algorithm for this problem. Try to minil number of subsets the algorithm needs to generate.See Answer

TutorBin Testimonials

I found TutorBin Design And Analysis Of Algorithms homework help when I was struggling with complex concepts. Experts provided step-wise explanations and examples to help me understand concepts clearly.

Rick Jordon

5

TutorBin experts resolve your doubts without making you wait for long. Their experts are responsive & available 24/7 whenever you need Design And Analysis Of Algorithms subject guidance.

Andrea Jacobs

5

I trust TutorBin for assisting me in completing Design And Analysis Of Algorithms assignments with quality and 100% accuracy. Experts are polite, listen to my problems, and have extensive experience in their domain.

Lilian King

5

I got my Design And Analysis Of Algorithms homework done on time. My assignment is proofread and edited by professionals. Got zero plagiarism as experts developed my assignment from scratch. Feel relieved and super excited.

Joey Dip

5

TutorBin helping students around the globe

TutorBin believes that distance should never be a barrier to learning. Over 500000+ orders and 100000+ happy customers explain TutorBin has become the name that keeps learning fun in the UK, USA, Canada, Australia, Singapore, and UAE.