0% found this document useful (0 votes)
74 views

Tutorial 2: FIT 1029 - Algorithmic Problem Solving

This tutorial document outlines tasks to help students get familiar with fundamental algorithms and data structures including bit strings, sorting algorithms, finding anagrams and palindromes, and calculating standard deviation. The tasks include representing subsets of a set as bit strings, comparing subsets using bitwise operations, implementing insertion and selection sort on a sample list, designing algorithms to find anagrams and determine palindromes of words, and creating an algorithm to calculate standard deviation using a provided formula.

Uploaded by

Ali Alabid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Tutorial 2: FIT 1029 - Algorithmic Problem Solving

This tutorial document outlines tasks to help students get familiar with fundamental algorithms and data structures including bit strings, sorting algorithms, finding anagrams and palindromes, and calculating standard deviation. The tasks include representing subsets of a set as bit strings, comparing subsets using bitwise operations, implementing insertion and selection sort on a sample list, designing algorithms to find anagrams and determine palindromes of words, and creating an algorithm to calculate standard deviation using a provided formula.

Uploaded by

Ali Alabid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Tutorial 2

FIT 1029 Algorithmic Problem Solving


5 March 2014 Prepared by Julian Garca
The objectives of this tutorial are:
To get familiar with bit strings.
To understand selection sort and insertion sort.
To get familiar with fundamental algorithms involving lists.
For this tutorial assume that the following operations are dened on lists:
length(list): returns the length of the list
delete(index, list): deletes the item list[index].
join(list1, list2): returns the list where list1 is joined to the start of list2.
add(item, list): adds item to the end of the list.
insert(item, index, list): inserts item into the list so that it becomes the item list[index]
Task 1: Bit strings
Construct a list consisting of all the bit strings representing the
subsets of S = {a, b, c}. Order the list in a way such that every
string differs from its immediate successor by one single bit.
1 1
Could it be useful to think about
graphs in this problem as well?
Given a set S and two subsets of it, A S and B S; design an
algorithm to nd the subset of S given by A B.
2 2
Assume that subsets are represented
as strings of bits.
Task 2: Sorting
Describe the sequence of changes to the list [A, L, G, O, R, I, T, H, M]
as it is sorted alphabetically using insertion sort and selection sort.
3 3
Suggestion: write down the sorting
algorithms as well, and follow them
carefully with the suggested list as
input.
Task 3: Anagrams
Given a list of English words, describe an algorithm which can nd
all the anagrams for a given word. For example, if you were given the
word post, you might return the list: [pots, spot, tops].
4 4
A similar algorithm is probably
behind: http://www.wordsmith.org/
anagram/
Task 4: Palindromes
Design an algorithm to determine if a given word is a palindrome.
Assume that the input word is represented as a list of letters.
5 5
Example palindromes: civic, level,
racecar.
tutorial 2. fit 1029 algorithmic problem solving 2
Task 5: Standard deviation
Design an algorithm that calculates the standard deviation of a list
of n real numbers using the formula provided. Hint: First design a
module to calculate the mean value of the list.
6 6
The standard deviation of x
1
x
n
is
dened as =

n
i=1
(x
i
x)
2
n1
, where x is
the mean value of the sequence dened
as
1
n

n
i=1
x
i
.

You might also like