|
|
|
Lecture 13 — midterm, hw4, linked list example
|
|
|
|
|
midterm
|
|
|
|
|
will have reference material
|
|
|
|
|
you won’t need to memorize options for commands
|
|
|
|
|
you won’t need to memorize the various test options
|
|
|
|
|
the shell
|
|
|
|
|
basic operations
|
|
|
|
|
redirection and piping
|
|
|
|
|
>, >>, <, etc.
|
|
|
|
|
command1 | command2
|
|
|
|
|
command substitution
|
|
|
|
|
command2 $(command1)
|
|
|
|
|
reading man pages
|
|
|
|
|
scripting
|
|
|
|
|
if, while, read, for
|
|
|
|
|
processing arguments
|
|
|
|
|
regular expressions and sed
|
|
|
|
|
character classes, quantifiers, grouping, anchors
|
|
|
|
|
using sed to substitute or delete lines
|
|
|
|
|
C
|
|
|
|
|
pointers
|
|
|
|
|
draw a picture of memory
|
|
|
|
|
structs
|
|
|
|
|
typedef
|
|
|
|
|
memory model
|
|
|
|
|
malloc, free
|
|
|
|
|
memory leaks
|
|
|
|
|
homework 4
|
|
|
|
|
organization
|
|
|
|
|
trie data structure
|
|
|
|
|
struct representing a node (recursive data structure)
|
|
|
|
|
functions:
|
|
|
|
|
create/init
|
|
|
|
|
insert
|
|
|
|
|
lookup
|
|
|
|
|
destroy
|
|
|
|
|
trie.h — declarations
|
|
|
|
|
trie.c — implementation
|
|
|
|
|
main
|
|
|
|
|
#include “trie.h”
|
|
|
|
|
probably shouldn’t define any structs, additional functions, etc.
|
|
|
|
|
linked list example
|
|
|
|
|
see posted files and shell recording
|
|
|
|
|
use valgrind to detect memory errors
|
|
|
|
|
valgrind COMMAND
|
|
|
|
|
should report 0 bytes lost
|
|
|