algorithms and data structures teach that lassie, what’s in this ads2 course ? will it be...

Post on 13-Jan-2016

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Algorithms and Data Structures

TEACH THAT

Lassie, what’s in this ADS2 course ? Will it be interesting?

woof!

Content

• linked lists• single/doubly-linked, • insert, delete, find, min, max, …

• stacks• push/pop/size• bracket matching, RP calculator

• queues• enqueue/dequeue/size• circular queue (in array)

• recursion• see above

• big O

Content

• trees• n-ary trees: representations & properties• binary trees

• representations & properties & traversals• binary search trees

• insert/find/delete/traverse/height …• AVL trees• heap

• insert/delete/sort• splay trees• red-black trees

Continued

Content

• skip lists• Sorting

• bubble/insert/sift sort• merge sort• quick sort• bucket sort (pigeon hole sort)• bead sort

• Dictionaries• maps and hash tables

• open and closed hashing

Continued

ContentContinued

• 5 pieces of practical work• 2 of above are assessed• exam• lab every 2nd week• woof

Algorithms&

Data Structures

Algorithms

&

Data Structures

Great!

my ADS2 website under construction

(permanently)I hate moodle

Home

News

The lectures

The lectures

code & api

Lots of code in there

DEMOS

demos

Links to interesting & useful stuff

exercises

Questions & Answers

Questions & Answers

… and now for something completely different!!!

Lassie, why are algorithms and data structures important?

Lassie, will there be anything in the course that is challenging and

exciting?

I just hope I get feedback, continuously

Lassie, will you teach us to “THINK LIKE A COMPUTER SCIENTIST”?

Lassie, honestly, I’m not that experienced as a programmer. Will you help us with our programming?

Will we use BIG data sets?

woof!

1st couple of lectures “Who cares?”

If someone was to teach you to drive a car would they:

1. explain how the internal combustion engine works2. take you through the intricacies of synchromesh gears3. fully independent suspension, spring rates, and dampers4. front and real wheel drive: pros and cons5. basic aerodynamics 6. …7. …

… or would they show you the knobs and levers and take you for a spin

Go for a spin

1st lecture … “Who cares?”

Who cares?Machines are getting

bigger, faster, cheaper … do efficient data

structures and algorithms really

matter?

An emotional attachment to algorithms and data structures

An empirical study using the IMDB

An emotional attachment to algorithms and data structures

An empirical study using the IMDB

An emotional attachment to algorithms and data structures

An empirical study using the IMDB

HashSet?

ArrayList?

woof

An emotional attachment to algorithms and data structures

An empirical study using the IMDB

An emotional attachment to algorithms and data structures

An empirical study using the IMDB

We could run this in the class for 1st three entries above

So? What was that about? This is 1st & 2nd lecture

Quickly/Immediately they get to see Alg & DS can have a dramatic effectWe use real dataWe use a big data setWe show that there is an empirical side to CSComputer Science is a Science

Okay, what’s next

The TSP challenge

It’s impossible to cover all the material we want to cover

So give them something that will draw them in …

Give them something that is fun …

The TSP challenge

100 Glasgow postal codes in a 5K radius

Find the shortest tour

not assessed, no marks, … a crappy trophy

Email me tour wheneverI will maintain website

Basic code with GUI on course website

Code is here

Data sets are here

Code is here

Our very own demo program

Our very own demo program

Our very own demo program

Your challenge is do write a method for the TSP class to find as short a route as possible round Glasgow. You have all

semester to do this.

That took about a week to develop

Furthest insertion algorithm used

Easy to add a solver

Students can do this if they want (no pressure)

Thanks SoCS for letting me do this

Footnote for all …

Some crappy prizes:

1. Green jacket2. Blue Riband3. Pint of milk at the Indy 5004. Victoria Cross5. A gold star6. …7. 4th year project prize

I am NOT kidding

next?

Instant feedback!!!

btree as an example

btree

btree

btree

btree

btree

btree

btree

btree

Ewe have to implement some of

the methods and test them

Any other examples Lassie?

Doubly Linked List

Any others

avlTree and emailOfDoom

avlTree and emailOfDoom

avlTree and emailOfDoom

Feedback?

Well, there are also programs that use your classes and methods and test them against

data sets, checks results are correct, complexity is within limits and gives you

“brownie” points. Richard’s seen this before. He could tell you more if you want.

What was this “THINK LIKE A COMPUTER SCIENTIST” stuff?

Count from zero?

I, being of sound mody and bind, herby swear that I will, on occasion, write java code in the class, that I will

explain what I am thinking and doing. I also swear that I will debug code in the class and I will explain what I am

thinking and what I am doing. I will try my best to explain what I think is good and what is bad as a Computer Programmer … as Almighty Dog is my

witness.

baaa!

An Example

Example of “Thinking Like a Computer Scientist”

I spent one day tracking down a bug in ADS2 code

I fixed it

No big deal

But wait. Why throw that day away?

Do something with it!

anatomy of a bug

anatomy of a bug

anatomy of a bug

AVL Trees

Anatomy of a bug

I wrote java code for the avl tree: the data structure, a test/demo programand managed to display it …

I felt … smug

smug

smugsmug

smug

smug

It was written all over me

… so smug that I just HAD to demo it to a friend/colleague …

Dr. Chris “unworthy” Unsworth

… and this is what happened

Calm down … think

Example

Example

Example

Example

So?

The sheep have a point dude.

This is what I hope to do

1. Capture the students’ interest2. Convince the class that studying/knowing/using ADS is worthwhile3. Teach students the basics of ADS & a wee bit more4. Develop students’ programming skills (and their programming appreciation)5. Give fast feedback6. Develop students’ programming skills (I already said that, didn’t I?)7. When appropriate, expose the thinking of a Computer Scientist8. Use realistic data sets where possible

Available from the gift shop now

top related