1 / 7

An Assortment of Things

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). The Plan for Today. A Musical Interlude

Download Presentation

An Assortment of Things

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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)

  2. 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 exams

  3. 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)

  4. 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 ambient

  5. Graphs • “Nodes” with edges between them • Could be “cyclic” or “acyclic” • Could be “directed” or “undirected” B A D C Might represents a map, where nodes represent cities and edges represent roads

  6. Represent the graph below with all 3 different mechanisms 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? booleanedgeExists = 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? booleanedgeExists = graph[3][17]; 1 0 2

  7. Can even be implicit You can move between two words if the last letter of the previous word matches the first letter of the next word grand dog dad

More Related