important algorithms and data structures

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 1 of 8
Assessment Task
Implement the sorting algorithm and C++ Standard Library tasks below to demonstrate your
understanding of the development and utilisation of important algorithms and data structures.
Please refer to the Instructions for details on how to complete each task.
Context
The two tasks below seek to examine your conceptual and practical understanding of some key
algorithms and data structures.
Task 1 focuses on comparing the performance of sorting algorithms against each other, and the
impact of the data’s ordering on performance. You likely won’t need to implement many searching
algorithms in the industry but crafting them yourself will give you firsthand practical experience at
seeing which types of algorithms perform better under different types of conditions. As a software

ASSESSMENT 2 BRIEF
Subject Code and Title ADS103 Algorithms and Data Structures
Assessment Programming Assignment 2
Individual/Group Individual
Length 2 source code solutions to programming problems
Learning Outcomes The Subject Learning Outcomes demonstrated by successful
completion of the task below include:
a) Identify and utilise appropriate algorithms to solve software
engineering problems.
b) Identify and utilise appropriate data structures to solve software
engineering problems.
d) Design and develop functions and classes to manage levels of
code complexity.
e) Demonstrate an understanding of recursive algorithms through
appropriate application.
f) Demonstrate the ability to read and interpret moderately complex
code, describe its purpose, and systematically debug for issues in
syntax or logic.
Submission Due by 11:55pm AEST/AEDT Sunday end of Module 8
Weighting 30%
Total Marks 100 marks

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 2 of 8
engineer, you will need to create algorithms here and there to solve unforeseen problems;
therefore, familiarity with multiple approaches will help.
Task 2 focuses on utilising pre-built data structures from the C++ Standard Library to store and
retrieve sets of data. In any given coding language, there are likely to be existing container
structures. You will practise with some common ones used in C++, but the use of these containers is
similar in approach in most languages.
Instructions
Task 1
You will write a program to retrieve a data set from a text file at a time and measure the time taken
to sort it with two different sorting algorithms. You can choose which sorting algorithms to write
from the provided options.
Provided are two text files, a2_task1_input1.txt and a2_task1_input2.txt. They are formatted similar
to the below example but with much more data:

100
628 234 581 595 968 285 42 775 353 109 862 101 117 598 291 276 767
69 919 264 98 683 582 510 656 927 200 507 580 822 408 330 662 842
362 474 199 137 873 875 791 525 842 304 157 351 789 708 384 667
309 398 281 997 100 12 279 834 100 68 185 295 329 98 232 883 284
67 607 981 767 705 478 844 753 992 245 755 826 493 803 520 221 36
975 997 964 992 349 347 657 698 347 539 951 337 506 287 25 762

Line 1 of the input file is the number of data elements to sort. Line 2 is the data elements to be
sorted.
Your Learning Facilitator may test with their own supplied input file reading any number of data
elements; therefore, ensure your code can be flexible. a2_task1_input1.txt contains completely
random numbers; a2_task1_input2.txt contains sorted data with only the first number out of
sequence.
1.1 Open a2_task1_input1.txt for reading (using, say,
std::ifstream).
1.2 Using the count value in line one of the file, read the number from line 2 into either a
dynamically allocated array or
std::vector.
1.3 Write either an insertion or bubble sort algorithm and sort the data.
1.4 Measure the time taken to complete the sort (in milliseconds).
1.5 Read the file contents once again into another dynamically allocated array or
vector.
You’re going to be sorting this fresh copy of the original file data—you don’t want to
inadvertently sort the already-sorted vector from step 1.3.
1.6 This time, write a quick sort or merge sort algorithm and measure how long it takes to
sort the data (in milliseconds).
1.7 Compare the times taken for the two sort operations and output. Which algorithm was
the quickest sorting this particular data set to the screen?

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 3 of 8
Repeat the above steps with a2_task1_input2.txt, this time to compare how the two algorithms
compete on a mostly sorted set of data.
Task 2
This task requires you to implement a simple book management system utilising the C++ Standard
Library.
Step 1
Write a menu screen that presents the user with these options:

What would you like to do:
1) List all books you have on loan
2) Return a book
3) List all books in the library
4) Borrow a book
5) Exit
Enter choice (1–5):

If the user enters a number from 1–4, the program moves on to that functionality. After it’s
complete (say, listing books on loan, or a user completes borrowing a book), the program should
loop back to the main menu.
Step 2
2.1 Include std::
vector and std::map libraries into the project. Create a map of books for the
library with
int as the key and string as value pair. Store at least 10 books, e.g.
books.insert(pair<int, string>(5, “Moby Dick”));
2.2 Create a vector of ints to store book IDs of borrowed books.
Step 3
Implement the menu actions as follows
1) List all books you have on loan: Output all the borrowed book IDs currently in your
vector alongside book name, which will need to retrieved from the books map. Here’s an
example:
5: Moby Dick
22: The Wizard of Oz
2: Charlie and the Chocolate Factory
etc.
2) Return a book: User is asked to input the ID of the book to return and if it exists in the
vector, remove that book from the book’s borrowed vector
3) List all books in the library: Output all IDs and book titles in the books map, e.g.
5: Moby Dick

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 4 of 8
22: The Wizard of Oz
9: Three Musketeers
etc.
4) Borrow a book: User is asked which book ID to borrow from the library. If it exists, add the
title to the user’s books borrowed
vector
5) Exit: quits the program
Step 4
Add in any relevant functions or classes to maintain the project.
Referencing
It is essential that you use appropriate APA style for citing and referencing research. Please see more
information on referencing here:
https://library.torrens.edu.au/academicskills/apa/tool
Crediting Sources of Acquired Code
Any source code you acquire from external sources (reference works, documentation, help and
tutorial sites etc.) must be preceded by a code comment that lists the original site/creator and
followed by a comment that declares the end of the acquired code. Acquisitions should be kept to a
few lines or fewer, and solve single problems (i.e. changing the range of a randomly generated
number, handling unexpected types of input data). Its preferable that you follow and adapt tutorials
to suit your purposes when looking for assistance.
Submission Instructions
Zip all projects, related files and any instructional readme.txt files for submission. Name this zip file
using this format: ADS103_[your name]_[studentID]_Assignment2.zip
Submit this task via the
Assessment link in the main navigation menu inADS103: Algorithms and
Data Structures. The Learning Facilitator will provide feedback via the Grade Centre in the LMS
portal. Feedback can be viewed in My Grades.
Before you submit your assessment, please ensure you have read and understand the conditions
outlined in the Academic Integrity Code Handbook. If you are unsure about anything in the
Handbook, please reach out to your Learning Facilitator.
Academic Integrity Declaration
I declare that. except where I have referenced, the work I am submitting for this assessment task is
my own work. I have read and am aware of Torrens University Australia Academic Integrity Policy
and Procedure viewable online at:
http://www.torrens.edu.au/policies-and-forms
I am aware that I need to keep a copy of all submitted material and their drafts, and I will do so
accordingly.

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 5 of 8
Assessment Rubric

Assessment
Attributes
Fail
(Yet to achieve
minimum standard)
0-49%
Pass
(Functional)
50-64%
Credit
(Proficient)
65-74%
Distinction
(Advanced)
75-84%
High Distinction
(Exceptional)
85-100%
Task 1: Demonstrate
understanding of
sorting and recursive
algorithms through
implementation.
Percentage for this
criterion = 35%
Implements little to none
of Task 1 requirements or
only demonstrates a
partially developed
understanding of
algorithm
implementation.
Demonstrates functional
knowledge of algorithms by
completing one of the below
tasks:
Implementing insertion
or bubble sort and using
it to sort data effectively.
Producing expected
results from sorting the
data and measuring time
taken to complete a sort
in milliseconds.
Implementing quicksort
or mergesort and using it
to sort data effectively.
Comparing the
performance of the two
sorting algorithms
selected and outputting
which was better for the
currently tested data set.
Demonstrates proficient
knowledge of algorithms by
completing two of the
below tasks:
Implementing insertion
or bubble sort and
using it to sort data
effectively
Producing expected
results from sorting the
data and measuring
time taken to complete
a sort in milliseconds
Implementing
quicksort or mergesort
and using it to sort data
effectively
Comparing the
performance of the
two sorting algorithms
selected and
outputting which was
better for the currently
tested data set
Demonstrates advanced
knowledge of algorithms by
completing three of the
below tasks:
Implementing insertion
or bubble sort and
using it to sort data
effectively.
Producing expected
results from sorting the
data and measuring
time taken to complete
a sort in milliseconds.
Implementing quicksort
or mergesort and using
it to sort data
effectively.
Comparing the
performance of the
two sorting algorithms
selected and
outputting which was
better for the currently
tested data set.
Demonstrates exceptional
knowledge of algorithms by
completing all of the below
tasks:
Implementing insertion
or bubble sort and
using it to sort data
effectively.
Producing expected
results from sorting the
data and measuring
time taken to complete
a sort in milliseconds.
Implementing
quicksort or mergesort
and using it to sort
data effectively.
Comparing the
performance of the
two sorting algorithms
selected and
outputting which was
better for the currently
tested data set.

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 6 of 8

Task 2: Demonstrate
understanding of data
structures by utilising
pre-built structures
provided in the
Standard Library.
Percentage for this
criterion = 35%
Implements little to none
of the Task 2
requirements or
demonstrates an only
partially developed
understanding of data
structures use.
Demonstrates functional
knowledge of data structures
by completing one of the
below tasks:
Including the right
standard library offerings
for the task and
populating the library
data structure with a set
of books.
Listing all data elements
within these data
structures.
Retrieving data from one
structure and adding it to
the other.
Erasing data elements
from data structures
cleanly.
Demonstrates proficient
knowledge of data
structures by completing
two of the below tasks:
Including the right
standard libraries for
the task and populating
the library data
structure with a set of
books.
Listing all data
elements within these
data structures.
Retrieving data from
one structure and
adding it to the other.
Erasing data elements
from data structures
cleanly.
Demonstrates advanced
knowledge of data
structures by completing
three of the below tasks:
Including the right
standard libraries for
the task and populating
the library data
structure with a set of
books.
Listing all data
elements within these
data structures.
Retrieving data from
one structure and
adding it to the other.
Erasing data elements
from data structures
cleanly.
Demonstrates exceptional
knowledge of data
structures by completing all
of the below tasks:
Including the right
standard libraries for
the task and
populating the library
data structure with a
set of books.
Listing all data
elements within these
data structures.
Retrieving data from
one structure and
adding it to the other.
Erasing data elements
from data structures
cleanly.

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 7 of 8

Adheres to submission,
quality and file naming
guidelines, and
subject’s coding
conventions.
Percentage for this
criterion = 15%
Project displays
inconsistent styling;
naming and commenting
and/or some files may be
missing from submission.
Project may have issues
running or compiling.
Project exhibits two of the
below qualities:
Project runs without
issues, bugs, or crashes.
Correct files are
submitted, including a
readme.txt if necessary.
Naming of files, classes,
functions, and variables
consistently matches
subject coding
conventions.
Project’s indentations
and whitespaces are
consistent and
communicative.
Code is well commented,
explaining each code
segment’s intention.
Project exhibits three of the
below qualities:
Project runs without
issues, bugs, or
crashes.
Correct files are
submitted, including a
readme.txt if
necessary.
Naming of files, classes,
functions, and variables
consistently matches
subject coding
conventions.
Project’s indentations
and whitespaces are
consistent and
communicative.
Code is well
commented, explaining
each code segment’s
intention.
Project exhibits four of the
below qualities:
Project runs without
issues, bugs, or
crashes.
Correct files are
submitted, including a
readme.txt if
necessary.
Naming of files, classes,
functions, and variables
consistently matches
subject coding
conventions.
Project’s indentations
and whitespaces are
consistent and
communicative.
Code is well
commented, explaining
each code segment’s
intention.
Project exhibits all below
qualities:
Project runs without
issues, bugs, or
crashes.
Correct files are
submitted, including a
readme.txt if
necessary.
Naming of files,
classes, functions, and
variables consistently
matches subject coding
conventions.
Project’s indentations
and whitespaces are
consistent and
communicative.
Code is well
commented, explaining
each code segment’s
intention.
Creates and uses classes
and functions to
manage complexity,
displaying an
understanding of
modular software
design.
Project does not use
functions and classes, or
uses them incorrectly.
Functions and classes are
used within the expected
minimal scope of each task.
Functions and classes are
used within the expected
minimal scope of each task.
Some additional functions
or classes have been
Functions and classes are
used within the expected
minimal scope of each task.
Some additional functions
or classes have been
Functions and classes are
developed and designed
exceptionally well, making
the project more
manageable throughout.

ADS103_Assessment_2_Brief_Programming_Assignment_2_M8 Page 8 of 8

Percentage for this
criterion = 15%
developed to help manage
complexity.
developed to help manage
complexity.
Some functions or classes
have been shifted into their
own files cleanly and used
correctly.
Classes and functions
shifted into separate files
cleanly and used correctly.

 

The following Subject Learning Outcomes are addressed in this assessment
SLO a) Identify and utilise algorithms appropriately to solve software engineering problems.
SLO b) Identify and utilise data structures appropriately to solve software engineering problems.
SLO d) Design and develop functions and classes to manage levels of code complexity.
SLO e) Demonstrate an understanding of recursive algorithms through appropriate application.
SLO f) Demonstrate the ability to read and interpret moderately complex code, describe its purpose, and systematically debug for issues in
syntax or logic.