Worksheet 4: Quiz Prep and Hash Tables
EECS 214
Spring 2017
Linked Lists
1. Answer the following questions based on this definition for a linked list:
class Node cfw_
object value;
Node next;
class L
Lecture 10
Hash tables
EECS-311
Dictionaries
A.k.a. associative
array, map,
mapping
Data structure that
holds associations
between pairs of
objects called keys
and values
Simplified interface
(well ta
Lecture 15
Applications of priority queues
EECS-311
http:/xkcd.com/835/
Priority queues
Like normal
queues
Objects wait in
line to be
processed
However, items
have an
associated
numeric priority
Prior
Lecture 5
Tree walks
and tree representations
EECS-311
Remember trees?
Trees
A tree is a graph
in which any pair
of nodes has
exactly one path
between them
Trees
In computer
science, we
usually think
Introduction to
Data Structures and
Algorithms EECS
Ian Horswill,
Department
Introduction to
Data Structures and
Algorithms
What do we study
when we study
algorithms?
We find solutions to
computationa
Lecture 14
Heaps and priority queues
EECS-311
Queues
Simplified
sequence data
structure
Insertions only at
the end (tail)
Deletions only
from the
beginning
(head)
Priority queues
Like normal
queues
Ob
Lecture 1
Mathematical preliminaries
EECS-311
Sets
Since the early
20th century, most
of mathematics
has been
described in terms
of set theory
Common
vocabulary for
describing a wide
Sets
Unordered
co
Lecture 4
Sequences and iterators
EECS-311
Memory structure
Ultimately, the computers memory
is one big array of bytes
Discrete chunks are allocated to
represent objects
And those objects are identifi
Lecture 3
Modularity
and abstract data types
EECS-311
software design
What makes a good design?
We want to
be able to
build our
programs
Easily
We also want our
programs to be
maintainable
Easy to fin
Lecture 9
Red/black trees
EECS-311
Note
If youre like me, then red/black trees will
make you feel stupid
Youll think
Id never have thought of that, or
I understand every individual step and yet I
stil
Lecture 6
How does compilation and
interpretation really work?
EECS-311
Why study programming
languages?
You may want to implement a
scriptinglanguageor macrolanguagefor
an application youre working o
Lecture 8
Binary search trees
EECS-311
Representing collections of
objects
Binary trees
Common case
Fixedbranching
factorof 2
Every node has
at most 2
children
Referred to as
the left child and
rightc
Lecture 7
The HappyFunBlob code
EECS-311
Demo
Code overview
Built on
Microsoft XNA
platform
Platformer
Jump from orb
to orb
Soft-body
Main gameplay objects
HappyFu
Levels
nBlobGa
me
Level
Level
Items
Lecture 11
Sorting 1
EECS-311
The 1900 US Census
Collect information
about every person
in the united states
Sex
Address
Race
Etc.
How many people
live in each state?
Age
Generate statistics
Name
How
Lecture 2
Introduction to the C#
language
EECS-311
What will this do?
void main() cfw_
printf(0 , test, 1);
What will this do?
void main() cfw_
printf(0 , test, 1);
C+ isnt type safe
What will this
Lecture 13
Graphs and graph search
EECS-311
Graphs
Informally, a graph
is a network of
objects connected
by lines or arrows
The objects are
called nodes or
vertices and the
lines are called
edges
Grap
EECS-214 Spring 2015 Practice Quiz 1
Answer the following questions as best you can. When writing code, you may not use any built-in
sequence types other than arrays.
EECS 214 Practice Quiz 3 Solutions
Question 1
Suppose you're given a weighted, undirected graph represented using an adjacency
matrix representation (i.e. a matrix of weights where the weight is if th
EECS 214 Practice Quiz 2 Solutions
Question 1
Consider the following sort algorithm:
Sort(array)
T = make an empty red/black tree
for each element e in array
add e to T
for i=0 to array.length-1
e = T
EECS-214 Spring 2017 Practice Quiz 1
Answer the following questions as best you can. When writing code, you may not use any built-in
sequence types other than arrays. In other words: if you need to us
EECS 214 Week 6 Worksheet
You can either choose write pseudocode or actual code for the exercises below. All of the
questions below -weve been in asked in technical interviews.
1. Given the singly lin
Worksheet
1. Considerthefollowingtree
Whatwouldbetheoutputifyouperformedthefollowingtraversalsonthistree:
a. Breadthfirsttraversal
b. Inorderdepthfirsttraversal
c. Preorderdepthfirsttraversal
d. Posto
Worksheet Week 5
1)
Insert the following keys into BST: A S E R C H I
2)
Given two values k1 and k2 (where k1 < k2) and a root pointer to the
following Binary Search Tree, printBST() function prints a
ImplementingQueuesandDeques
Summary
For this assignment, you should implement the following classes
Array-based queues
Linked-list-based queues
Deques using a doubly-linked list
We have provided you w
Exercise2:Asimpleinterpreter
Out: Satuday, April 25
Due: Friday, May 1, 12 noon
Important:pleaseread
We would like to remind you that the following are considered cheating for this class:
Modifying th
Lecture 7
Binary search trees
EECS-214
Representing collections of objects
Weve been looking at collection classes
Store a bunch of objects
Different flavors support
Notice these are all bad at sear
Lecture 5
Tree walks
and tree representations
EECS-214
Remember trees?
Trees
A tree is a graph in
which any pair of
nodes has exactly
one path between
them
Trees
In computer science,
we usually thin
Lecture 3
Modularity
and abstract data types
EECS-214
so;ware design
What makes a good design?
We want to be
able to build our
programs
Quickly
Easily
Reliably
#lang dssl2
# HW1: DSSL Warmup
# Due: Thursday, Oct. 5 at 11:59 PM, via GSC
#
# * You must work on your own for this assignment. *
#
# DATA DEFINITIONS
#
# An AccountId is a Natural
# An Account is ac
#lang dssl2
# HW4: Binary Heaps
# Due: Thursday, November 2, at 11:59 PM, on GSC
#
# * You may work on your own or with one (1) partner. *
# Ord[X] is a function X X -> Boolean
# Interpretation: a tot
#lang dssl2
#lang dssl2
# HW2: Three Dictionaries
# Due: Thursday, Oct. 12 at 11:59 PM, via GSC
#
# * You may work on your own or with one (1) partner. *
#
# ACCOUNT DEFINITIONS
#
# AccountId is Natur
#lang dssl2
#lang dssl2
# HW4: Binary Heaps
# Due: Thursday, November 2, at 11:59 PM, on GSC
#
# * You may work on your own or with one (1) partner. *
# Ord[X] is a function X X -> Boolean
# Interpret