Introduction to Symbol Tables Computer Science Engineering Otterbein
Introduction to Symbol Tables Computer Science Engineering Otterbein University COMP 2100 Otterbein University
Alerts Computer Science Otterbein University o Read 3. 1 -3. 2 o Lab 5 released tomorrow o HW 3 due Friday o Project 2: forms teams now! released on Thursday
Symbol Tables Computer Science Otterbein University o An abstract concept that has had numerous software incarnations over many decades A data structure in which the elements are key/value pairs A kind of container Keys and values can be of any type Keys must be unique, non-null values Elements may or may not be ordered, depending on application/implementation As with all containers, iteration must be supported
Equivalent concepts Computer Science Otterbein University o Dictionary: Python, C#, Julia, Smalltalk, Tcl o Associative Array: awk, Go, LISP, Perl, PHP o Map: Java, C++, Red, YAML, OCaml, Scala o Table: SNOBOL, SQL, Lua o Object (non-standard): Java. Script, JSON
Symbol Table Applications Computer Science Otterbein University
Symbol Table API Computer Science Otterbein University
Conventions Computer Science Otterbein University o Values are not null (beware of Java) o get() returns null if key not present o put() overwrites old value with new value o contains() is easy to implement public boolean contains(Key key) { return get(key) != null; } o delete() can be implemented lazy public void delete(Key key) { put(key, null); }
Keys & Values Computer Science Otterbein University
Equality Computer Science Otterbein University
Computer Science Otterbein University
Computer Science Otterbein University
Computer Science Otterbein University
- Slides: 12