1/30
Vocabulary flashcards covering Java syntax, graph representations, and traversal algorithms (BFS and Dijkstra) based on the CampusNavigator lecture.
static (in static class Edge)
Specifies that the nested class belongs to CampusNavigator itself, allowing an Edge object to be instantiated without creating an instance of CampusNavigator first.
void
A return type keyword indicating that a method performs an action but returns no value back to the caller (e.g., public void addBuilding(…)).
Constructor
A special method with no return type (not even void) that matches the exact name of its class and executes automatically when new is called.
this.destination
The object's internal field variable stored within Edge, distinguished from the plain destination parameter passed into the constructor.
implements
A keyword indicating that a class guarantees to fulfill the contract of an interface by providing definitions for all of its required methods (such as compareTo for Comparable
compareTo (Node)
A method required by Comparable
@Override
A compiler annotation indicating that a method is implementing or overriding a method declared in an interface or superclass, triggering a compile-time error if the method signature does not match.
HashMap
A class that stores key-value pairs and provides key lookup with an average time complexity of O(1).
Map (vs. HashMap)
Map is an interface defining expected operations (put, get, containsKey), while HashMap is the concrete implementation. Declaring variables as Map allows alternative implementations to be swapped in without changing remaining code.
Hashtable
An older, thread-safe class in Java that stores key-value pairs, which is not used by the CampusNavigator code.
adjList (CampusNavigator)
A private Map data structure where each key is a building (node/vertex) and each value is an ArrayList containing the Edge objects departing from that building.
Diamond Operator (<>)
An empty pair of angle brackets in object instantiation (e.g., new HashMap<>()) that instructs Java to infer generic type arguments directly from the variable's declaration.
Campus Graph Properties
An undirected, weighted graph consisting of 8 buildings (vertices), 10 walking paths, and 20 Edge objects (each path stored twice, once in each direction).
BFS Route (Hibbard to Schofield)
Hibbard \rightarrow Haas \rightarrow Schofield, totaling 2 stops and 687m (365+322).
Dijkstra Route (Hibbard to Schofield)
Hibbard \rightarrow Phillips \rightarrow Davies \rightarrow Schofield, totaling 3 stops and 521m (150+200+171).
BFS vs. Dijkstra Routing Criterion
BFS solely minimizes the number of edge hops (stops) regardless of distance, whereas Dijkstra minimizes cumulative path distance (meters).
@param
A Javadoc tag used to document a method parameter for code readers; it is ignored during execution but displayed in code editor tooltips.
@return
A Javadoc tag that describes the value returned by a method, including special values like empty collections.
putIfAbsent
A Map method that maps the specified key to a value only if the key is not already present, preventing existing edge lists and paths from being overwritten.
ArrayList
A resizable-array implementation of the List interface that automatically grows and shrinks as items are added or removed, allowing duplicates and null elements.
addPath
A method that verifies both buildings exist and meters is strictly greater than 0, then adds two directed edges (a→b and b→a) to maintain an undirected graph.
prev Map (BFS)
A map storing predecessors as prev.put(edge.destination, current), which simultaneously tracks visited buildings and enables path backtracking.
FIFO (First In, First Out)
The processing order of BFS's queue, ensuring nodes 1 stop away are fully dequeued and explored before nodes 2 stops away.
BFS Time Complexity
O(V+E), achieved because the algorithm checks whether a node is in prev before queuing it, ensuring each vertex is processed at most once.
reconstructPath
A helper method that traces backward from the end building to the start building using the prev map and reverses the sequence so it reads start \rightarrow end.
Collections
A Java utility class providing static helper methods such as Collections.emptyList(), not to be confused with the Collection interface.
poll()
A queue method that retrieves and removes the front (cheapest) element of a PriorityQueue, returning null if the queue is empty.
peek()
A queue method that inspects the element at the head of the queue without removing it.
Stale Entry (Dijkstra)
An obsolete node representation inside the priority queue whose cost is higher than the currently known shortest distance to that building, discarded via continue.
Deque
A double-ended queue supporting insertion and removal at both endpoints; used as a LIFO stack in reconstructPath to reverse the backward-traversed path.
ArrayDeque
A modern, efficient implementation of Deque recommended by Java documentation for stack operations in place of the legacy Stack class.