Part 1 - Euclidean Algorithm 1. Use the Euclidean Algorithm to find the greatest common divisor of ( integers 396 and 480. (Show all workings)

icon
Related questions
Question
Case Study 3
Part 1 - Euclidean Algorithm
1. Use the Euclidean Algorithm to find the greatest common divisor of (
integers 396 and 480. (Show all workings)
Part 2
Problem: Measuring Efficiency
One challenge we will face is how to compare the efficiencies of two or more algorithms,
to determine which is more efficient. We will have to use a common measure for
example time or space
First, we must determine what is most important to us (time or space or some other
measure). Then compare the efficiencies (e.g., how much time each algorithm takes to
execute, or how much space each algorithm uses). The challenge of timing an algorithm
may introduce unwanted bias or overheads, therefore, we need a method that makes
comparison fair. We are usually interested in the order of growth of the running time of
an algorithm, not in the exact running time. Asymptotic notation gives us a method for
classifying functions according to their rate of growth.
Scenario:
Bigi-Xam 9.0 is a mobile app development workshop and competition hosted by the
government and an international partner. The final entry date is March 01, 2023 and the
winner will be announced on June 1, 2023.
You have been invited to the panel of judges for the most efficient business app
category. Show how you would rank each of the following four (4) business apps, from 1
(most efficient) to 4 (least efficient) using Big O. Note that c in each of the algorithms
below represents the number of customers that the business app will have to process.
Show all your workings and ranking scale.
f(c) = 84 +59c(log)) + 150c +590c(log)) + 203c + 5900c(log))
f(c) = 412c + (111 * 10c) + 2048
f(c) = 9 (c*c*c*c*c)+7(c* c) + 351c + c + 2 C² + ½ c²
f(c) = 1/2 c² + 1/4 c² + 1/8 c²2+ 1/16 c² + 1/32 c² + 7(c* c)
App a)
App b)
App c)
App d)
3
Transcribed Image Text:Case Study 3 Part 1 - Euclidean Algorithm 1. Use the Euclidean Algorithm to find the greatest common divisor of ( integers 396 and 480. (Show all workings) Part 2 Problem: Measuring Efficiency One challenge we will face is how to compare the efficiencies of two or more algorithms, to determine which is more efficient. We will have to use a common measure for example time or space First, we must determine what is most important to us (time or space or some other measure). Then compare the efficiencies (e.g., how much time each algorithm takes to execute, or how much space each algorithm uses). The challenge of timing an algorithm may introduce unwanted bias or overheads, therefore, we need a method that makes comparison fair. We are usually interested in the order of growth of the running time of an algorithm, not in the exact running time. Asymptotic notation gives us a method for classifying functions according to their rate of growth. Scenario: Bigi-Xam 9.0 is a mobile app development workshop and competition hosted by the government and an international partner. The final entry date is March 01, 2023 and the winner will be announced on June 1, 2023. You have been invited to the panel of judges for the most efficient business app category. Show how you would rank each of the following four (4) business apps, from 1 (most efficient) to 4 (least efficient) using Big O. Note that c in each of the algorithms below represents the number of customers that the business app will have to process. Show all your workings and ranking scale. f(c) = 84 +59c(log)) + 150c +590c(log)) + 203c + 5900c(log)) f(c) = 412c + (111 * 10c) + 2048 f(c) = 9 (c*c*c*c*c)+7(c* c) + 351c + c + 2 C² + ½ c² f(c) = 1/2 c² + 1/4 c² + 1/8 c²2+ 1/16 c² + 1/32 c² + 7(c* c) App a) App b) App c) App d) 3
Case Study 1
Problem: Merge Sort
Merge Sort follows the rule of Divide and Conquer to sort a given set of
numbers/elements, recursively, hence consuming less time.
Merge sort runs in O(n*log n) time in all the cases. Two functions are involved in this
algorithm. The merge() function is used for the merging two halves and the mergesort()
function recursively calls itself to divide the array until the size becomes one.
Use the array below to perform a Merge Sort. Show all necessary workings.
(75, 22, 65, 97, 35, 56, 18, 89)
Case Study 2
Problem: Hashing
Hashing is a technique to convert a range of key values into a range of indexes of an
array. Load Factor is a measure of how full the hash table is allowed to get before its
capacity is automatically increased which may cause a collision. When collision occurs,
there are two simple solutions: Chaining and Linear Probe.
In what order could the elements have been added using the output below and given
the following hash table implemented using linear probing. Note the following:
A
B
C
D
E
1. The hash function used is the identity function, h(x) = x.
2. Assume that the hash table has never been resized, and no elements have been
deleted yet.
3. There are several correct answers
4. Show all workings
0
9
1
18
2
3
12
9, 14, 4, 18, 12, 3, 21
12, 3, 14, 18, 4, 9, 21
12, 14, 3, 9, 4, 18, 21
9, 12, 14, 3, 4, 21, 18
12, 9, 18, 3, 14, 21, 4
4
3
5
14
6
4
7 8
21
2
Transcribed Image Text:Case Study 1 Problem: Merge Sort Merge Sort follows the rule of Divide and Conquer to sort a given set of numbers/elements, recursively, hence consuming less time. Merge sort runs in O(n*log n) time in all the cases. Two functions are involved in this algorithm. The merge() function is used for the merging two halves and the mergesort() function recursively calls itself to divide the array until the size becomes one. Use the array below to perform a Merge Sort. Show all necessary workings. (75, 22, 65, 97, 35, 56, 18, 89) Case Study 2 Problem: Hashing Hashing is a technique to convert a range of key values into a range of indexes of an array. Load Factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased which may cause a collision. When collision occurs, there are two simple solutions: Chaining and Linear Probe. In what order could the elements have been added using the output below and given the following hash table implemented using linear probing. Note the following: A B C D E 1. The hash function used is the identity function, h(x) = x. 2. Assume that the hash table has never been resized, and no elements have been deleted yet. 3. There are several correct answers 4. Show all workings 0 9 1 18 2 3 12 9, 14, 4, 18, 12, 3, 21 12, 3, 14, 18, 4, 9, 21 12, 14, 3, 9, 4, 18, 21 9, 12, 14, 3, 4, 21, 18 12, 9, 18, 3, 14, 21, 4 4 3 5 14 6 4 7 8 21 2
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer