Data Structures & Algorithms
Data Structures & Algorithms
INTRODUCTION:
This subject material has been prepared for use in the training of students undergoing the
National Diploma course in Information Technology at approved or registered
vocational/technical training institutions.
UNIT CONTENT:
The general objectives of each unit and the specific objectives of the topic areas are set out
herein.
The units are prefixed by capital letters, the unit objectives by non-decimal numbers and topic
objectives by decimal numbers.
All objectives are to be understood to relate to what the student should be able to “do” at the
end of each respective topic. The guiding language for this subject is PASCAL.
SUBJECT UNITS
A. ELEMENTARY CONCEPTS
B. RECORDS
C. RECURSION
D. SEARCHING AND SORTING ALGORITHMS FOR TABLES
E. POINTERS AND LINKED LISTS
F. STACKS
G. QUEUES
H. TREES
I. GRAPHS
J. FILES
CONTENT
A. ELEMENTARY CONCEPTS
1 Data and information
Students can describe the difference between data and information.
B. RECORDS
Students can describe the data type record, should be able to declare and use record types in problem solving.
Students should be able to design data structures in which arrays and records are mixed.
C. RECURSION
Students can describe the general concept of recursion and can determine the output of recursive subprograms.
Students should be able to write recursive algorithms, these include algorithms for factorial, fibonacci sequence,
towers of Hanoi and quicksort.
2. Sorting
Students can describe the general concept of sorting.
Students can demonstrate how the following sorting methods for tables work. For each they can give an algorithm
and they can describe the relative merits of each algorithm. Sorting methods include bubble sort, selection sort,
insertion sort and shell sort.
F. STACKS
1 THE ADT STACK
The student is able to design the interface for the ADT Stack, including createStack, destroyStack, push, pop,
isEmpty and topOfStack.
The student is able to implement this ADT using static and dynamic techniques.
The student can describe the differences and relative merits of these two implementations.
The student can describe how the stack is used in computer environments (subprogram calls, undo-redo
operations). The student can apply Stacks in the solving of problems; this includes algorithms to convert infix
expressions (with and without brackets) to postfix and to evaluate of postfix expressions.
G. QUEUES
1 THE ADT QUEUE
The student is able to design the interface for the ADT QUEUE, including createQueue, destroyQueue, enqueue,
dequeue and isEmpty.
The student is able to implement this ADT using static (including linear and circular arrays) and dynamic
techniques.
The student can describe the differences and relative merits of these two implementations.
The student can describe how Queues are used in computer environments (including queue for print jobs, event
queue) and can apply Queues in the solving of problems including simulations and radix sort.
2 THE ADT PRIORITYQUEUE
The student is able to design the interface for the ADT PRIORITYQUEUE (ascending and descending), including
createQueue, destroyQueue, enqueue, dequeue and isEmpty.
The student is able to implement this ADT using static and dynamic techniques.
H. TREES
1. THE ADT BINARY TREE
The student is able to design the interface for the ADT BINARYTREE, including createNullTree, createNode,
setLeft, setRight, getLeft, getRight, setInfo, getInfo, isEmpty.
The student is able to implement this ADT using static (including implicit and explicit arrays) and dynamic
techniques.
The student can describe the differences and relative merits of these two implementations.
The student can apply BinaryTrees in writing algorithms for Binary Search Trees, this includes, the construction
of a BST, the deleting of a node from a BST, traversing a BST, sorting using a BST and evaluation of expressions.
J. FILES
The student can describe Pascal's structured files. The student is able to declare a structured file and knows how
to read from and write to structured files.
The student can write an algorithm for a merge sort.