This class will go over the exam If you havent taken the exam yet like maybe you forgot and didnt show up please dont attend this class Please get in groups of 34 people 4 is better1 and 2 are NOT ok ID: 167934
Download Presentation The PPT/PDF document "An Assortment of Things" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
An Assortment of Things
This class will go over the exam. If you haven’t taken the exam yet (like maybe you forgot and didn’t show up) please don’t attend this class.
Please get in groups of 3-4 people (4 is better…1 and 2 are NOT ok)Slide2
The Plan for Today
A Musical Interlude
We review a few key questions from the exam
whoWinsPilesList
(Recursive backtracking)
getMissingParens
(Stacks)
I introduce “Graphs” the final structure we will look at
Hand back examsSlide3
The Music Video Project
A student created
CompSci
100 tradition
Create a music video, recorded song, or just a set of lyrics about some part of
CompSci
100.
Work in groups
Your creations will be played as folks arrive for the final exam
Extra credit (but that’s not really the point)Slide4
Work on teams of 3-4 to Solve
whoWinsPilesList
Do not work by yourself or with a partner
Snarf
the code and check your solution as you develop it
There is a hint at the bottom of the
textfile
, if everyone on you team really is stuck
When you finish, more on to
getMissingParens
Make sure
everyone
on your team understands how this code works
When you are finished, submit your code via ambientSlide5
Graphs
“Nodes” with edges between them
A
B
C
D
Could be “cyclic” or “acyclic”
Could be “directed” or “undirected”
Might represents a map, where nodes represent cities and edges represent roadsSlide6
A Node Class…similar to the way we do with linked lists and trees
class Node {
public String name;
public
ArrayList
<Node> neighbors;
}
A adjacency list, where each node ‘name’ maps to a list of neighbors
HashMap
<
String,ArrayList<String>> graph;//is there an edge from a to b?boolean edgeExists
= graph.get(“A”).contains(“B”);A adjacency matrix, where connections between nodes is represented by a 2D matrix
boolean [][] graph;//is there an edge from 3 to 17?boolean edgeExists = graph[3][17];
Represent the graph below with all 3 different mechanisms
0
1
2Slide7
Can even be implicit
dog
grand
dad
You can move between two words if the last letter of the previous word matches the first letter of the next word