b. module objective c. module outcomes d. …csi.ufs.ac.za/courses/csis2614/2015/ris214 module guide...

14
RIS214 (2014) 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 (2014) DATA STRUCTURES MODULE GUIDE A. CONTACT DETAILS Lecturer: Prof. Pieter Blignaut Office: WWG 312 Telephone: 051 401 2754 E-mail: [email protected] Consulting Hours: Per appointment Assistant: Mr. Daniël Wium Office: WWG221 Telephone: 051 401 2362 E-mail: [email protected] B. MODULE OBJECTIVE This module is on NQF level 6. After successful completion of the course you will be competent to implement a variety of data structures to do problem solving in an object oriented, visual, high level programming environment. C. MODULE OUTCOMES At the end of the course you should be able to discuss and implement classes, objects, inheritance, polymorphism, events and delegates; be able to discuss what data structures are and how to use them; be familiar with recursion and its use; be able to implement and use lists, stacks, queues and sets; be able to implement and use binary trees; understand how to design and modify data structures to solve a problem. D. COMMUNICATION Attendance of theory classes and practical sessions is compulsory. You will be largely disadvantaged if you miss a class. Do not get behind with the work! Contact the lecturer or assistant in time if you have any problems with the work. Attendance of practicals or assistance at other subjects or probation (for example education students) are not acceptable excuses. Appointments with the lecturer or assistant must be scheduled by e-mail. Read your e-mail regularly. It is the responsibility of the student to ensure that he/she receives all the information in connection with this module that is provided during the theoretical classes, on the CSI server, on the notice board in the Mathematical Sciences Building on the third floor, in the calendar or by e-mail. All enquiries should be addressed to the assistant before you consult the lecturer. You must at all times have this guide as well as a pen with you when you consult the lecturer or the assistant.

Upload: builiem

Post on 30-Jan-2018

225 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS

RIS 214 (2014) DATA STRUCTURES

MODULE GUIDE

A. CONTACT DETAILS

Lecturer: Prof. Pieter Blignaut

Office: WWG 312 Telephone: 051 401 2754

E-mail: [email protected]

Consulting Hours: Per appointment

Assistant: Mr. Daniël Wium Office: WWG221

Telephone: 051 401 2362

E-mail: [email protected]

B. MODULE OBJECTIVE

This module is on NQF level 6. After successful completion of the course you will be competent to implement a variety of data structures to do problem solving in an object oriented, visual, high level

programming environment.

C. MODULE OUTCOMES

At the end of the course you should

• be able to discuss and implement classes, objects, inheritance, polymorphism, events and

delegates;

• be able to discuss what data structures are and how to use them;

• be familiar with recursion and its use;

• be able to implement and use lists, stacks, queues and sets;

• be able to implement and use binary trees;

• understand how to design and modify data structures to solve a problem.

D. COMMUNICATION

Attendance of theory classes and practical sessions is compulsory. You will be largely disadvantaged if you miss a class. Do not get behind with the work! Contact the lecturer or assistant in time if you

have any problems with the work. Attendance of practicals or assistance at other subjects or probation (for example education students) are not acceptable excuses.

Appointments with the lecturer or assistant must be scheduled by e-mail. Read your e-mail regularly.

It is the responsibility of the student to ensure that he/she receives all the information in connection

with this module that is provided during the theoretical classes, on the CSI server, on the notice board in the Mathematical Sciences Building on the third floor, in the calendar or by e-mail.

All enquiries should be addressed to the assistant before you consult the lecturer.

You must at all times have this guide as well as a pen with you when you consult the lecturer or the assistant.

Page 2: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 2

E. STUDY MATERIAL

• Supplementary notes, practical assignments, solutions to tests and practical assignments, etc. will

periodically be posted on the Internet (http://csi.ufs.ac.za/courses/ris214/2014). You are responsible to ensure that you receive everything in time and study them. Note that Blackboard is not used for this module.

• RIS214 will be using C# (C sharp) as language for all programming.

• The following two books are the primary resources for this module.

- McMillan, M. 2007. Data Structures and Algorithms Using C#. Cambridge University Press. - Nakov, S. et al. 2013. Fundamentals of Computer Programming with C#. Available at

http://www.introprogramming.info/wp-content/uploads/2013/07/Books/CSharpEn/Fundamentals-of-Computer-Programming-with-CSharp-Nakov-eBook-v2013.pdf

• The following books are secondary sources for this module:

- Blignaut, P.J. 2010. Be Sharp with C# - Mitchell, S. 2005. An Extensive Examination of Data Structures Using C# 2.0. Available at

http://msdn.microsoft.com/en-us/library/hh830851(v=vs.80).aspx - Preiss, B.R. 2001. Data Structures and Algorithms with Object-Oriented Design Patterns in C#.

Available at

http://www.ica.luz.ve/cstufano/CursoEDyA/Libros/Data%20Structures%20and%20Algorithms%20wi

th%20Object-Oriented%20Design%20Patterns%20in%20C%23%20-%20Bruno%20Preiss.pdf - Wikibooks.org. 2013. C Sharp Programming. Available at

http://upload.wikimedia.org/wikipedia/commons/b/b3/C_Sharp_Programming.pdf

• Other sources

- Wiener, R. 2007. Modern Software Development Using C#.Net. Brooks/Cole, ISBN 0-619-21759-6. - http://www.freeprogrammingresources.com/csharp-books.html

- http://download.damieng.com/documentation/Dissecting_A_CSharp_Application.pdf - http://www.informit.com/library/library.aspx?b=STY_Csharp_24hours

- http://msdn.microsoft.com/en-us/library/ms364091%28VS.80%29.aspx

- http://www.slideshare.net/abedbukhari/csharp4-arrays-andtuples-7781284 - http://en.wikipedia.org/wiki/Big_O_notation

- http://msdn.microsoft.com/en-us/library/ms379570 - http://www.perlmonks.org/?node_id=573138

- http://www.apcomputerscience.com/apcs/misc/BIG-O.pdf - http://en.wikibooks.org/wiki/Data_Structures/Asymptotic_Notation

F. CONTACT SESSIONS

This module consists of two theoretical periods per week and one practical session of 3 hours per

week. Attendance of theoretical classes and practical sessions is compulsory.

1 2

Afrikaans Wednesdays 09:10 – 10:00, FGG378

Thursdays 08:10 – 09:00, FGG378

English Wednesdays

12:10 - 13:00, FGG378

Thursdays

08:10 – 09:00, FGG378

Practicals Wednesdays, 14:10 – 17:00, WWG225

Page 3: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 3

G. LABORATORY USAGE

All practicals and tests will be done in the Computer Science Labs (WWG225 & 316) during the assigned practical sessions.

H. ASSESSMENT

Module mark

The module mark will be determined through eight (8) class tests and two module tests. See the module calendar below for the dates of the class tests and module tests. Class attendance : 10% of module mark Class tests : 30% of module mark Module test 1 : 30% of module mark Module test 2 : 30% of module mark. • You must write all module tests and class tests. Failure to do any module test will result in a

result of incomplete for the module and you may not write exam. Failure to do a class test will result in a zero mark for the specific test. No arrangements will be made if you fail to write a class test in the designated period.

• Your course will be incomplete if - you did not attend at least 80% of all lectures - you fail to write both module tests (or a sick test instead of one module test) - you fail to write at least eight (8) class tests.

• Students who register late will not be accommodated. This is not a text book subject that you can catch up in own time.

• Tests will not be marked if you are not registered for RIS214. The module mark will be available on 16 May 2014 on the notice board. No marks will be provided over the telephone. Promotion and exam

• This is not a promotion module. All students must write the examination. • Marks for tests, examinations and assignments may be held back if required so by the

administration of the university in cases of students not registered for the module or outstanding fees.

Sick test

If you have a valid doctor certificate for any module test and submitted it within 48 hours after the test, you will be allowed to write the sick test on 14 May. Note, however, that the sick test will cover all the work of the entire semester and not only the work of the test that you missed. The sick test policy of the Department of Computer Science and Informatics is published on the notice board on the third level of the Mathematical Sciences Building and will be strictly applied. Only in the following circumstances will students qualify for a sick test: 1. In the event of absence of a module test due to illness. A valid medical certificate, wherein the

doctor stipulates the diagnosis of illness and that you were not in a position to write a module test, must be submitted within 48 hours after the test. Please note that the lecturer might call the doctor to confirm the legality of the medical certificate. A certificate that reads "As I was informed" is not valid. The doctor must examine you and must stipulate the nature and seriousness of the disease.

2. With the death of any of your immediate family. You are required to hand in a certified copy of the relevant death certificate to the lecturer within 48 hours after the test.

Note also the following conditions: 1. Should you qualify for the sick test and you do not write the test on the given date and time, no

further tests will be set up. 2. Participation in sport, cultural activities, the attendance of weddings, or transport problems etc.

are not valid reasons for the absence of tests. 3. No member of the Student Representative Council or House Committee may give you permission

not to write a test or examination.

Page 4: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 4

I. MODULE CALENDAR

WEEK DATE Assessments CONTENT

1 Th: 5, 6 Feb Primitive types and variables, Operators and expressions,

Console input and output, Conditional statements, Loops, Arrays Pr: 5 Feb

2 Th: 12, 13 Feb

Methods, Recursion, Algorithm complexity Pr: 12 Feb CT1

3 Th: 19, 20 Feb

Objects and classes

Advanced OO principles

Pr: 19 Feb CT2

4 Th: 26, 27 Feb

Pr: 26 Feb CT3

5 Th: 5, 6, 7 Mar Persistent data

High-quality code

Searching and Sorting

Lambda expressions and LINQ

Pr: 5 Mar CT4

6 Th: 12, 13 Mar

Pr: 12 Mar T1

7 Th: 19 Mar

Lists

Stacks Queues

Pr: 19 Mar CT5

8 Th: 26, 27, 28 Mar

Pr: 26 Mar CT6

9 Th: 2, 3 Apr

BitArray, String, StringBuilder, Regular expressions Pr: 2 Apr CT7

10 Th: 9, 10 Apr

Trees and Graphs Pr: 9 Apr CT8

11 Th: 16, 17 Apr

Pr: 16 Apr CT9

12 Th: 23, 24 Apr

Dictionaries, Hash tables, Sets Pr: 23 Apr CT10

Holiday

13 Th: 7, 8 May

Dictionaries, Hash tables, Sets Pr: 7 May T2

14 14, 15 May Revision

14 May Sick test

16 May Semester ends

19 May First exam opportunity

_ June Second exam opportunity (Only with special permission)

Page 5: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 5

J. DETAILED MODULE OVERVIEW

Key of symbols

Lecture content These topics will be discussed in class and will be examined.

Self-study You must study these topics yourself. They will be examined.

Revision

These topics were discussed in the first year and are of

importance here as well.

Additional reading These topics are for enrichment.

Week 1: Revision of Basics

• Primitive Types and Variables (Nakov Chapter 2) http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-2-primitive-types-and-variables/

o Data Types Nakov 115, Wiki 2.18 o Variables and Fields Nakov 127, Wiki 2.8, Preiss 1243

o Lifetime and Scope Wiki 2.11, Preiss 1243 o Value and Reference Types Nakov 132, Wiki 2.9, Preiss 1245-1246

http://msdn.microsoft.com/en-us/library/ya5y69ds.aspx

http://msdn.microsoft.com/en-us/library/3ewxz6et.aspx o Null references Preiss 1248

o Literals Nakov 135 o Pointer manipulation Wiki 2.19

• Operators and Expressions (Nakov Chapter 3)

http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-3-operators-and-expressions/

o Operators Nakov 143, Blignaut 21, Wiki 2.12-2.17

o Type conversion and Casting Nakov 156, Blignaut 19 o Expressions Nakov 162, Wiki 2.4-2.5

• Console Input and Output (Nakov Chapter 4)

http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-4-console-input-and-output/

• Conditional Statements (Nakov Chapter 5)

http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-5-conditional-statements/

• Loops (Nakov Chapter 6)

http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-6-loops/

• Arrays (Nakov Chapter 7) http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-7-arrays/

o Collections in .Net McMillan 1-11, Blignaut 165-170 o What is an array? Nakov 239, Wiki 2.24, Preiss 204-234, Blignaut Chapter

10, Mitchell Part 1 o Declaration and allocation of memory Nakov 239, McMillan 27

o Access to elements Nakov 242, McMillan 28 o Array metadata McMillan 28

o Reading and writing an array Nakov 245 o Iteration through the elements Nakov 248

o Parameter arrays McMillan 32 o Multidimensional arrays Nakov 250, Preiss 218, McMillan 30-31

o Arrays of arrays Nakov 257, McMillan 32-34

LC

SS

Rev

AR

SS

SS

SS

SS

SS

LC

Rev

Rev

Rev

Page 6: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 6

• Extending C# arrays (Preiss 207-217) o Constructor Preiss 208

o Copy Preiss 210

o Indexers Preiss 213, Wiki 3.6 o Properties Preiss 214

o Resize Preiss 217

Week 2: Methods, Recursion and Algorithm Complexity

• Methods (Nakov Chapter 9) http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-9-methods/

o Subroutines Nakov 297 o What is a method? Nakov 297

o Why to use methods? Nakov 298 o Declaration Nakov 299

o Implementation Nakov 304

o Invoking Nakov 305 o Parameters Nakov 307, Preiss 1250-1256

o Returning a result Nakov 332 o Best practices Nakov 349

• Recursion (Nakov Chapter 10)

http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/

o What is recursion? Nakov 355

o Example Nakov 355 o Direct and Indirect recursion Nakov 356

o Bottom of Recursion Nakov 356 o Recursive methods Nakov 356

o Recursive calculation of factorial Nakov 357 o Recursion or Iteration? Nakov 359

o Simulation of N nested loops Nakov 360 o Analysis of efficiency: Fibonacci numbers Nakov 366

o Example: Paths in a Labyrinth Nakov 372 o Conclusions Nakov 382

• Algorithm Complexity (Nakov Chapter 19) http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-19-data-structures-and-algorithm-complexity/

o Typical algorithm complexities Nakov 774 o Complexity and execution time Nakov 776

o Complexity by several variables Nakov 778 o Best, worst and average cases Nakov 778

o Roughly estimated complexity Nakov 778 o Complexity by memory Nakov 779

o Examples Nakov 779

• Top-down Algorithms: Divide and Conquer (Preiss 960-970) o Using recursion to divide and conquer Preiss 960 o Example: Binary search Preiss 961

o Example: Fibonacci numbers Preiss 964 o Example: Merge sort Preiss 967

o Running time of divide-and-conquer algorithms Preiss 970

AR

SS

LC

LC

AR

Rev

Page 7: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 7

Week 3 & 4: Objects and Classes

• Creating and Using Objects (Nakov Chapter 11) (Revision from RIS124) o Classes and Objects Nakov 389, Blignaut 207 o Classes in C# Nakov 391, Blignaut 208-218

o Creating and Using Objects Nakov 394, Blignaut 220 o Namespaces Nakov 409

• Defining Classes (Nakov Chapter 14)

o Introduction Wiki 3.12

o Reference and Value types Wiki 3.13 o Custom classes Nakov 503

o Partial classes Wiki 4.12 o Usage of classes and objects Nakov 506

o Organizing classes in files and namespaces Nakov 509, Wiki 3.1

o Modifiers and access Levels (Visibility) Nakov 512, Wiki 4.7 o Declaring classes Nakov 513

o The reserved word this Nakov 515 o Fields Nakov 516

o Methods Nakov 522, Wiki 3.2 o Accessing non-static data Nakov 523

o Hiding fields with local variables Nakov 526 o Visibility of fields and methods Nakov 528, Wiki 3.15

o Constructors Nakov 535, Wiki 3.3, Wiki 3.14.1, Blignaut 218-220 o Destructors Wiki 3.4, Wiki 3.14.2

o Properties Nakov 553, Wiki 3.5 o Static classes and static members Nakov 563, Wiki 3.10, Blignaut 221-222

• Defining Classes (Nakov Chapter 14)

o Indexers Wiki 3.6

o Structures Nakov 584, Wiki 2.23, 3.9 o Enumerations Nakov 588, Wiki 2.22

o Inner classes (nested classes) Nakov 594

o Generics Nakov 598, McMillan 14-17, Wiki 4.13, 4.14, 4.15, 4.16 o Operator overloading Wiki 3.8

• Advanced OO Principles (Nakov Chapter 20)

o Fundamental principles of OOP Nakov 812

o Inheritance Nakov 813, Wiki 4.1, 4.2, Blignaut 234, 243 � The base keyword Nakov 814

� Constructors with inheritance Nakov 815, Wiki 4.4 � Access modifiers of class members and inheritance Nakov 816

� The System.Object class Nakov 818 � .Net standard libraries and objects Nakov 819

� The base type object upcasting and downcasting Nakov 819 � Object.ToString() method Nakov 820

� Overriding ToString() Nakov 821 � Virtual methods: override and new Nakov 822, Wiki 4.5

� Transitive properties of inheritance Nakov 824 � Class diagrams Nakov 825, Blignaut 234

o Abstraction Nakov 828, Blignaut 243

SS

SS

LC

SS

Rev

Rev

Rev

Page 8: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 8

• Advanced OO Principles (Nakov Chapter 20) o Interfaces Nakov 829, Wiki 4.6

� Additional reading

http://msdn.microsoft.com/en-us/library/87d83y5b(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/vstudio/ms173156.aspx

http://www.codeproject.com/Articles/18743/Interfaces-in-C-For-Beginners http://stackoverflow.com/questions/6802573/c-sharp-interfaces-whats-the-point

http://stackoverflow.com/questions/2271104/class-vs-interface http://www.dotnetperls.com/interface

http://www.tutorialspoint.com/csharp/csharp_interfaces.htm http://csharp-station.com/Tutorial/CSharp/Lesson13

o Encapsulation Nakov 832, Blignaut 243 o Polymorphism Nakov 834, Blignaut 243

� Abstract classes Nakov 834, Blignaut 236 � Virtual methods Nakov 837, Wiki 4.3, Blignaut 236

o Cohesion and coupling Nakov 840 o Delegates Wiki 4.8, 4.9, 4.10,

http://msdn.microsoft.com/en-us/library/ms173171(v=vs.110).aspx o Events Wiki 3.7, 4.11, Preiss pp 264-306

• Advanced OO Principles (Nakov Chapter 20) o Object-Oriented Modelling (OOM) Nakov 846 o UML notation Nakov 848

� Use Case Diagrams Nakov 848 � Sequence diagrams Nakov 849

� Statechart diagrams Nakov 850 � Activity diagrams Nakov 851

o Design patterns Nakov 851 � Singleton Nakov 852, Wiki 4.20

� Factory method Nakov 853, Wiki 4.19 � Dispose Wiki 4.18

� Other design patterns Nakov 855

Week 5 & 6: Persistent data, High-quality code, Searching and Sorting, Lambda expressions and LINQ

• Text files (Nakov Chapter 15) o Streams Nakov 619

o Reading from a text file Nakov 624, Blignaut 254-259 o Writing to a text file Nakov 632, Blignaut 254-259

o Input / Output exception handling Nakov 634 o Text files – More examples Nakov 635

• Serialization (Blignaut 262-265)

o Save an object to binary file Blignaut 262

o Read an object from binary file Blignaut 263 o Save and retrieve a list of objects to/from a binary file Blignaut 264

• High-quality programming code (Nakov Chapter 21)

o Quality code Nakov 857-861

o Identifier naming Nakov 861-870

o Code formatting Nakov 870-878 o High-quality classes Nakov 878-882

o High-quality methods Nakov 882-887 o Proper use of variables Nakov 887-894

o Proper use of expressions Nakov 894-895

o Use of constants Nakov 895-898 o Proper use of control flow statements Nakov 898-902

o Defensive programming Nakov 902-904 o Code documentation Nakov 904-908

o Code refactoring Nakov 908-909 o Unit testing Nakov 909-916

LC

AR

SS

SS

SS

Rev

Rev

Rev

Page 9: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 9

Until now it was easy going – mostly revision of RIS114 and RIS124. Now you better hold on – we are going on a roller-coaster ride: either very difficult or very fast. Your safety belt is glue on the bums. • Basic Sorting Algorithms (McMillan Chapter 3)

o An array class test bed McMillan 43

o Bubble sort McMillan 45 o Selection sort McMillan 48

o Insertion sort McMillan 50 o Timing comparison of the basic sorting algorithms McMillan 51

• Basic Searching Algorithms (McMillan Chapter 4)

o Sequential searching McMillan 55

o Searching for minimum and maximum Values McMillan 58

o Making sequential search faster McMillan 59 o Binary search McMillan 62

o Recursive binary search McMillan 64

• Lambda expressions and LINQ (Nakov Chapter 22) o Extension methods Nakov 919 o Anonymous types Nakov 922

o Lambda expressions Nakov 924 � Lambda expressions with anonymous types Nakov 926

� Sorting with lambda expressions Nakov 926 � Statements in lambda expressions Nakov 927

� Lambda expressions as delegates Nakov 927 o LINQ queries Nakov 928

� Data sources Nakov 928 � Data filtering Nakov 929

� Results of LINQ queries Nakov 929 � Sorting data Nakov 930

� Grouping results Nakov 930

� Joining data Nakov 932 o Nested LINQ queries Nakov 934

o LINQ performance Nakov 934 o Additional reading Wiki 4.10.1, Blignaut 197-198

Week 7 & 8: Linear Data Structures

• Linear Data Structures (Nakov Chapter 16)

o Abstract data structures Nakov 645

o List data structures Nakov 645, Wiki 5.8

� Static list (Array-based implementation) Nakov 647 � The problem with arrays McMillan 194-195

� Linked list (Dynamic implementation) Nakov 653, Wiki 5.9, Preiss 235-237, McMillan 195-199, Mitchell Part 4

� Exercise: Modify the dynamic implementation

to include a method for insertion of a node � Comparing the static and dynamic lists Nakov 661

� Double-linked list Nakov 663, McMillan 200-203 � Exercise: Implement the doubly-linked list

o Additional reading � Circularly linked list McMillan 203-205

� An iterator class McMillan 206-214 � The generic LinkedList and

LinkedListNode classes McMillan 214-216

Built-in .Net structures o The ArrayList class Nakov 663, Mitchell Part 1, McMillan 35-40 o Generic collections Nakov 665

o The List<T> class Nakov 666, Mitchell Part 1 � Prime numbers in given interval – Example Nakov 667

� Union and intersection of lists Nakov 668 � Converting a list to an array and vice versa Nakov 672

o The LinkedList<T> class Nakov 672

LC

LC

LC

LC

AR

LC

Page 10: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 10

o Stack Nakov 673, Wiki 5.11, McMillan 68, Mitchell Part 2

� Stack operations (Push, Pop, Peek, etc.) Nakov 674, McMillan 69

� Static stack (array-based implementation) Nakov 673 � Linked stack (Dynamic implementation) Nakov 674

� Exercise: Develop static and dynamic custom implementations of a stack

� The built-in .Net Stack<T> class Nakov 674

o Queue Nakov 676, Wiki 5.10, McMillan 80, Mitchell Part 2

� Queue operations (Enqueue, Dequeue and others) Nakov 678, McMillan 80 � Static queue (array-based implementation) Nakov 677

� Linked queue (Dynamic implementation) Nakov 677 � Exercise: Develop static and dynamic custom implementations of a queue

� The built-in .Net Queue<T> class Nakov 678

o Additional reading

� A stack implementation McMillan 70 (Might be confusing with Nakov) � A stack class example Decimal to multiple base

conversion McMillan 78 � A queue implementation McMillan 81 (Might be confusing with Nakov)

� Sample queue application McMillan 82

� Sorting data with queues McMillan 86 � Priority queues McMillan 90

� Circular array Mitchell Part 2

Week 9: Bits and Strings

• The BitArray class (McMillan Chapter 6) o A motivating problem McMillan 94 o Bits and bit manipulation McMillan 96

� The binary number system McMillan 96 � The bitwise and bit-shift operators McMillan 97

o A bitwise operator application McMillan 99 � The bit-shift operators McMillan 103

o An integer-to-binary converter application McMillan 104

o A bit-shift application McMillan 107 o The BitArray class McMillan 110

o Using a BitArray to write the Sieve of Erastostenes McMillan 114 o Comparison of BitArray versus Array for Sieve

of Eratosthenes McMillan 117

• Strings, the String class and the StringBuilder class (McMillan Chapter 7) o Working with the String class McMillan 119

� Creating String objects McMillan 120

� Frequently used String class methods McMillan 121 � The Split() and Join() methods McMillan 124

� Methods for comparing strings McMillan 126 � Methods for manipulating strings McMillan 130

o The StringBuilder class McMillan 137

� Constructing StringBuilder objects McMillan 138 � Obtaining and setting information about

StringBuilder objects McMillan 138

� Modifying StringBuilder objects McMillan 139 o Comparing the efficiency of String to StringBuilder McMillan 143

• Pattern Matching and Text Processing (McMillan Chapter 8) o Introduction to regular expressions (REs) McMillan 147

o Working with REs McMillan 148 o Quantifiers McMillan 151

o Using Character classes McMillan 153 o Modifying REs using assertions McMillan 156

o Using grouping constructs McMillan 157 o The CapturesCollection class McMillan 161

o RE options McMillan 163

AR

AR

SS

Rev

LC

LC

LC

LC

Page 11: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 11

Week 10 & 11: Trees and Graphs

• Trees (Nakov 685-717, McMillan Chapter 12) o Terminology Nakov 686, Mitchell Part 3, McMillan 218-220 o Binary trees Nakov 698, Mitchell Part 3, McMillan 220-226

� Exercise: Implement a method to insert a node in the tree � Recursive traversal of a binary tree Nakov 700

o Ordered binary search trees (BST) Nakov 702, Mitchell Part 3 � Properties of the ordered BST Nakov 704

� Inserting an element Nakov 709 � Searching for an element Nakov 710

� Removing an element Nakov 711 � Printing in ascending order Nakov 714

o Balanced trees Nakov 716 � The hidden class TreeSet<T> in .Net Nakov 717

Additional reading o Tree implementation – Example Nakov 688

o Depth-first search Nakov 693 o Traverse the hard drive directories Nakov 694

o Breadth-first search Nakov 696 o Finding a node and minimum/maximum values in a BST McMillan 227-228

o Removing nodes McMillan 228-235 o AVL trees (self-balancing tree) Mitchell Part 4

o Red-black trees Mitchell Part 4 o Skip-lists Mitchell Part 4

• Graphs (Nakov Chapter 17)

o Basic concepts Nakov 718

o Presentations Nakov 720

o Basic operations Nakov 721 o Common graph applications Nakov 725

Additional reading (McMillan Chapter 16) o Graph definitions McMillan 283 o Real world systems modelled by graphs McMillan 284

o The Graph class McMillan 285 o A Graph application: Topological sorting McMillan 289

o Searching a graph McMillan 293 � Depth-first search McMillan 294

� Breadth-first search McMillan 296 o Minimum spanning trees McMillan 299

o Finding the shortest path McMillan 302

o Additional reading Mitchell Part 5

LC

AR

LC

AR

Page 12: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 12

Week 12 and 13: Dictionaries, Hash tables and Sets

• Dictionaries (Nakov Chapter 18) o Dictionary Data Structure - Example Nakov 731 o The abstract data structure Dictionary Nakov 732

o Dictionary operations Nakov 733 o IDictionary<K,V> Nakov 733

o Implementation of Dictionary with Red-Black tree Nakov 734 o SortedDictionary<K,V> Nakov 735

Additional reading (McMillan Chapter 9) o Basics Mitchell Part 2

o The DictionaryBase class McMillan 165 o The generic KeyValuePair class McMillan 171

o The SortedList class McMillan 172

• Hash tables (McMillan Chapter 10, Nakov Chapter 18) o Overview McMillan 176, Nakov 739 o Choosing a hash function McMillan 177, Nakov 744

o Searching for data in a hash table McMillan 180 o Handling collisions McMillan 180, Nakov 746-7, 752-764

� Bucket hashing McMillan 181 � Open addressing McMillan 183, Nakov 762-764

� Double hashing McMillan 183, Nakov 763 � Cuckoo Hashing Nakov 763-764

o The HashTable class McMillan 184 � Read Nakov p 734. HashTable is deprecated.

o A HashTable application: Computer terms glossary McMillan 189

o Dictionary implementation with hash-table Nakov 739

o Class Dictionary<K,V> Nakov 741 o Students and Marks – Example Nakov 742

o The method GetHashCode() Nakov 745, 747-749 o Interface IEqualityComparer<T> Nakov 749

o Implementation of a dictionary with hash table and chaining Nakov 752-762

o Additional reading Mitchell Part 2

• Sets (Nakov Chapter 18) o Fundamentals McMillan 237-239 o The abstract data structure Set Nakov 764

o Set implementations in the .Net framework Nakov 765 o Implementation with hash table – HashSet<T> Nakov 766

o Implementation with Red-Black tree – SortedSet<T> Nakov 767

Additional reading o Implementation using a hash table McMillan 239

� Data members McMillan 239

� Constructor McMillan 239 � Methods (Add(), Remove(), Size(), Union(),

Intersection(), isSubset(), Difference() ) McMillan 240-242 � A program to test the implementation McMillan 243

o Implementation using a BitArray McMillan 244 o Additional reading Mitchell Part 6

• Choosing a Data Structure (Nakov Chapter 19)

o Comparison between Basic Data Structures Nakov 783

o When to use a particular data structure? Nakov 783 o Choosing a data structure – Examples Nakov 790

o External Libraries with .Net Collections Nakov 805

LC

AR

LC

LC

AR

AR

LC

Page 13: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 13

Additional reading: Advanced Algorithms

• Advanced Sorting Algorithms (McMillan Chapter 14) o ShellSort McMillan 249 o MergeSort McMillan 251

o HeapSort McMillan 254 o QuickSort McMillan 259

• Advanced Data Structures and Algorithms for Searching (McMillan Chapter 15)

o AVL Trees McMillan 263

o Red-Black trees McMillan 268 o Skip lists McMillan 275

• Advanced Algorithms (McMillan Chapter 17) o Dynamic programming

� Fibonacci numbers McMillan 314

� Finding the longest common string McMillan 319 � The Knapsack problem McMillan 322

o Greedy algorithms � The Coin-Changing problem McMillan 324

� Data compression using Huffman coding McMillan 326 � The Knapsack problem McMillan 333

AR

Page 14: B. MODULE OBJECTIVE C. MODULE OUTCOMES D. …csi.ufs.ac.za/courses/CSIS2614/2015/RIS214 Module Guide 2014.pdf · board in the Mathematical Sciences Building on the third ... result

RIS214 (2014) 14

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS

RIS 214 (2014) PERSONAL DETAILS

Student number _____________________________

Surname _____________________________

Initials _______

Title _______

First name _____________________________

Address during semester ________________________________________________________

________________________________________________________

Telephone numbers ________________________ (cell)

________________________ (home / residence)

________________________ (parents)

E-mail ________________________________________________________

Preferred instruction medium Afrikaans English

I have received the RIS214 (2014) module guide. I understand the contents thereof and I will abide by the

rules as stipulated.

Signature _______________________

Date _______________________