SIT221: Data Structures and Algorithms - Space and Time Complexity - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

Task:

Task Objective
In this task you will use knowledge and skills of algorithm space and time complexity to answer a series of questions.

Background
The way we write code affects how fast that code runs and the amount of memory it uses. When only dealing with small amounts of data the efficiency does not matter very much. However, as the amount of data increases, such as those in most real?world applications, so does the importance of our choice of algorithm. The aim of this unit is to ensure we write solutions to problems that run as efficiently as possible. Therefore, we need to be able to measure how efficient each algorithm is in?order to compare our options and select the right solution for the problem.
We define complexity as the time it will take to solve for an input size of n elements, often expressed with the function T?n?. We want to be able to define this time such that it does not depend on the implementation used. This means when finding the complexity of an algorithm in general we want to remove individual implementation factors, such as processor speed, instruction set, disk speed, compiler, bus speed etc and focus just on the algorithm itself. We can do this evaluation using one of several methods: Operation Counting, Asymptotic Notations, Substitution Method, Recurrence Tree, Master Method. In this unit we will look at the first two approaches, while SIT320 Advanced Algorithms will look at the last the three methods.

Operation Counting is a process where we calculate the amount of times each operation in an algorithm is run giving us the total number of operations. This results in a complex function that may not always be easy to use when comparing algorithms. Therefore, we typically estimate complexity of each algorithm asymptotically. Asymptotic notation aims to classify algorithms according to their performance. This means, rather than find the exact efficiency (as in Operation Counting) we want to group algorithms that behave similarly. This categorisation is done based on the number of elementary steps, taken in constant time, the algorithm takes to complete.

There are different approaches to classifying the time function depending on the way the behaves as it approaches a limit point, eg positive or negative infinity or zero. These are based around the Upper Bound (called Big?O), the Lower Bound (called Big Omega) and the Tightly Bound (called Big Theta) notations. Frequently, documents will often only refer to the Upper Bound (Big?O) complexity of an algorithm. Using this notation there are a number of classifications that an algorithm is typically placed, such as (in increasing complexity) O?1?, O?log? n?, O?n?, O?n log? n?, O?n??, O?n? log? n?, O?n??, O?2?? and O?n!?. When analysing an algorithm, we may wish to determine the complexity of the algorithm in different situations representing different operational situations. For instance, it is common to consider the best, worst and average situations. For example, we may want to know how well a search algorithm will perform if the first item it looks at is the item it is searching for. We may also want to understand what happens if it is the last item in the array and frequently we want to know how it will perform on average. With many algorithms the average complexity is the same as the worst case.

You should review the lecture and read up on Asymptotic Notations and complexity then answer each of the questions on this sheet

Questions
In this task, answer all the following questions and complement each answer with a detailed explanation.
1. Review the following algorithms (assume any undeclared variables are declared earlier)

 

 

task

 

For each of the above answer each of the following
a) What is the number of operations of the best, worst and average cases?
b) Describe the best, worst and average case using Big?Θ notation.
c) Describe each algorithm’s overall performance using the tightest possible class in Big?O notation.
d) Describe each algorithm’s overall performance using the tightest possible classin Big? Ω notation.
e) Describe each algorithm’s overall performance using Big?Θ notation.
f) Selecting from one or more of the above which is the best way to succinctly describe the performance of each algorithm using asymptotic notation.

2. Arguably, the most commonly used asymptotic notation used is frequently Big?O. Discuss why this is so commonly the case.
3. Isit true that θ?n?? algorithm alwaystakeslongerto run than an θ?log n? algorithm? Explain your answer.
4. Answer whether the following statements are right or wrong and explain your answers.

double a = 0;
a += rand();
if( a < 0.5 ) a += rand();
if( a < 1.0 ) a += rand();
if( a < 1.5 ) a += rand();
if( a < 2.0 ) a += rand();
if( a < 2.5 ) a += rand();
if( a < 3.0 ) a += rand();

int count = 0;
for (int i = 0; i < N; i++)
{
int num = rand();
if( num < 0.5 ){
count += 1;
}
}

int count = 0;
for (int i = 0; i < N; i++)
{
if (unlucky)
{
for (j = N; j > i; j--)
{
count = count + i + j;
}
}
}

int count = 0,
int i = N;
if (unlucky)
{
while (i > 0)
{
count += i;
i /= 2;
}
}

int count = 0;
for (int i = 0; i < N; i++)
{
int num = rand();
if( num < 0.5 )
{
count += 1;
}
}
int num = count;
for (int j = 0; j < num; j++)
{
count = count + j;
}

for (int i = 0; i < N - 1; i++)
{
for (int j = 0; j < N-i-1; j++)
{
if (a[j] > a[j+1])
{
Swap(a[j], a[j + 1]);
}
}
}

 

 

Further Notes
 You may find the attached Asymptotic Cheat Sheet useful to clarify the mathematical notation.
 You will find ultimate answers to these tasks by exploring chapters 4.1.?4.3 of the course book “Data Structures and Algorithms in Java” by Michael T. Goodrich, Irvine Roberto Tamassia, and Michael H.
Goldwasser (2014). You may access the book on?line for free from the reading list application in CloudDeakin available in Resources ? Course materials ? Course Book: Data structures and algorithms in Java.

 

This SIT221: IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.