300 likes | 458 Views
Week 1A. Introduction and Module Overview. Contact Details. Announcements. Practical sessions will run in Wk 1. They will cover: Overview of Java. Netbeans Tutorial. Sending an email from WebCT . Module Overview. Data Structures and Algorithms COM328 Lectures
E N D
Week 1A Introduction and Module Overview
Announcements • Practical sessions willrun in Wk 1. • They will cover: • Overview of Java. • Netbeans Tutorial. • Sending an email from WebCT.
Module Overview • Data Structures and Algorithms • COM328 • Lectures • Tuesday 10.15 – 11.05pm • Thursday 3.15 – 5.05pm • Practicals • Thursday 9.15 – 11.05pm (Gp A1 and A2) • Thursday 13.15 – 3.05pm (Gp B1 and B2)
Module Goals • Learn about commonly used data structures and algorithms. • Learn how to analyse and compare their performance.
READING MATERIAL ACCESS TO A TEXTBOOK IS ESSENTIAL!! • Recommended Texts • Data Structures • Java Software Structures, John Lewis and Joseph Chase,2004,Addison Wesley 3rd Ed. • Data Structures and Problem Solving Using Java, Mark Allen Weiss, 1998, Addison Wesley • Data Structures and Algorithms in Java, Robert Lafore. • Data Strucutes and Algorithms Using Java, William McAllister • Java • Java Software Solutions, Lewis & Loftus, Addison Wesley, 2004, 4th Ed. • host of other books on Java!
Coursework & Examination • 25% Coursework • 2 Class Tests (10% each) • Assignment 1 (40%) • Assignment 2 (40%) • 75% Examination • 3hr paper – Choose 4 questions from a possible 6, covering a range of topics taught throughout the module. • NOTE: You need to pass both the coursework and examination elements in order to successfully pass the module!
A Cautionary Note • Read UU plagarism guide: • http://www.ulster.ac.uk/academicservices/student/plagiarism.pdf • Plagiarism within programming is easy to spot! • All coursework elements should be individual pieces of work. • You are free to discuss problems with your peers and even potential solutions but ultimately the work submitted should be your own. • Be careful about using code directly from the web / books – especially if you do not fully understand it!
Final Administrative Note • Attempt to attend all classes. • Tuesdays will focus on smaller topics, practical reviews, assignment feedback etc. • Thursdays will focus on introducing new concepts. • Class tests may also take place on Thursdays • Learning to program is difficult if you don’t know what you’re doing: • So show up and find out! • Don’t be afraid to ask Questions!
Data Structures and Algorithms • What is a Data Structure? • Simply a way to organise information. • A group of numbers, a list of names, group of Students, a bag of bingo balls. • What is an Algorithm? • Abstract way to perform computation tasks • Find some important piece / group of stored data, sort some data alphabetically, partition data etc…
Module Topics Overview • Java Review • Abstract Data Types, data structures and Interfaces • Arrays • Linked Lists • Stacks • Queues • Lists • Sorting • Searching • Recursion and Iteration • Algorithm Analysis Linear Data Structures Collections Algorithms Performance
Data Types • Data type – group of values and possible operations. • An abstraction hides certain details at certain times. • What is an Abstract Data Type? • Conceptually describes the valid types of data and the ways in which data can be accessed: • Type of data stored. • Operation supported and types of their parameters. • Specifies WHAT not HOW! • Consider driving a car • In Java ADT’s are supported by Interfaces • Interfaces are then implemented by you to specify the HOW!
Collections • Gathers and organizes other objects. • Underlying data structures are used to implement collections • Conceptually describes how elements of the collection can be stored, accessed and managed – a set of rules. • A collection of cards, a collection of letters, telephone directory • Over the last 50 yrs several different types of collection have been defined to solve different problems. • Collections are abstractions – hides certain details. • Describe What NOT How. • In Java, collections are also known as containers. • Collections are implemented by data strucutres.
Interface Interface Class that uses the collection Class that implements the collection
Types of Data Structure (1) • Arrays Linked Lists address Node 1 next top 110 120 130 140 150 160 649 N1 20 Node 2 649 next Node 3 N2 97 Node 4 20 next N3 null Node 5 97 Node 6
Other Data Structures (2) • Trees • Graphs • Sets
Java Collections API • Java already provides a very large library of classes, which offer implementations of several types of collection. • Why should we bother learning about and implementing collections if Java already provides the solutions for us? • Java provides only a subset of the collections that you might want. • Java may not have implemented the collection exactly how you wanted it. • To become a good programmer, it is important to develop a deep understanding of the steps involved in implementing collections.
The Stack Collection • Linear Collection where items are add to and removed from the same end. • Stack ADT specifies WHAT: • Push, Pop, Peek, isEmpty, size… • HOW can these be implemented? • Using either an Array or Linked List depending on the problem being solved. Source: Java Software Structures, Chase and Lewis, 1st Edition.
The Queue Collection • Item add to rear and removed from front. • Enqueue & dequeue • HOW can these be implemented? • Using either an Array or Linked List! Source: Java Software Structures, Chase and Lewis, 1st Edition.
The List Collection • Ordered, Unordered, Indexed. • Items can be added to front, end or somewhere in the middle. Source: Java Software Structures, Chase and Lewis, 1st Edition.
Algorithms for use with Data Structures • Insert and Delete • Sorting algorithms • Selection, Bubble, Insertion • Mergesort, Quicksort • Searching • Linear Search • Binary Search
Fast Sorting - Mergesort 2 5 1 9 3 8 7 Unsorted Divide 9 3 8 7 2 5 1 Unsorted Sort 3 7 8 9 1 2 5 1 2 5 Sorted Merge 1 2 3 5 7 8 9 Sorted
Searching Sequential / Linear Binary
Recursion & Iteration Source: http://www.skylit.com/javamethods/ppt/index.html
Algorithm Analysis • Practice: • benchmarks • Theory: • asymptotic analysis, big-Oh O(1) < O(logn) < O(n) < O(nlog n) < O(n2) < O(n3) < O(an)
Big-Oh Notation cont… Basically a method for theoretically comparing different algorithms. - save us having to physically code different algorithms. - More next week…