Exam2recap

Be actively involved
• Yoda said, "Do or do not, there is no try.“
• Wanted to learn a language by listening to
a tape in my sleep.
– A whole industry of language learning
products is based on something that I have to
frankly say that I think is absolute rubbish.
– Some people swear by it, and yet it rarely ever
produces any useful results.
– The shocking truth is that passive listening is
never going to get you to fluency in a
language. What’s even worse is that it won’t
even help your ability to understand.
Consider the odds
• GO BIG OR GO BROKE.
– “The average slot machine is probably two, three times
more costly to players than the table games,” says
Zender. Avoid them. If you insist on cranking a handle,
focus on slots that cost $5 or more and play the max
bet. On penny slots, the odds are jacked up in the
house’s favor by 15 to 20 percent. You might as well
toss those coins in a fountain. Don’t forget to make a
wish.
• What are the odds you will pass by not doing the
assignments or taking the quizzes?
• Retakes are very costly. College of Engineeringthree course limit to repeats in pre-professional
program. Do-overs haven’t been free since 7th
grade volleyball.
We all learn differently
• If you learn best by seeing the program run,
RUN IT.
• If you learn best by seeing the program
develop line by line. Type in the code and
think about each line.
• Observing is good, but
doing is essential. Can’t learn
to swim by listening to lessons.
• take ownership over your
education
Get your money’s worth
• Get an A but learn nothing. Asked, “Then why
are you in this class.” Didn’t you hear me, “I
got an A and didn’t have to do anything.”
• …each class should be five minutes long, taught
by holograms of Rihanna, and consist entirely
of self-graded multiple-choice tests composed
in emoji.
No one learns best by
• Playing on cell phone [text during interview, book at
dinner]. If you think you aren’t missing anything…
• Sleeping through class
• Missing class
• If you don’t learn the material faster and better with an
instructor, show me how well you are learning on your
own. Those with the high scores are here every day,
actively involved in the discussion.
Average 77%, High 101 (fudge)
Speak technically
• We have a vocabulary for communicating
algorithmic concepts. Use it. That is part of
what makes you appear competent.
• Fake it til you make it.
This is not presidential debates
• When asked a question, going off in another
direction spouting facts is a waste of effort. It
should really earn you negative points for not
even understanding what is being asked.
• Yada yada yada
Problem is confusing
• That is an important part of a job. People will
describe what they need. You have to be able
to decode what they are saying.
• Earn the right to understand.
• Practice listening in class.
• Practice by taking quizzes.
Reading code is important
•
•
•
•
Reading other’s code is extremely common
Reading your own code will save you hours.
Trial and error only worked in 1400.
Close only counts in horseshoes and
grenades
Ask…
• Would the change I am considering correct the
problem that is described (or evident)?
Fill in the blank
• WHAT is a hashing method which uses two distinct hash
tables?
• WHAT is a data structure which keeps track of a set of
elements partitioned into a number of non-overlapping
sets.
• A hash table is implemented using lazy deletion, Name an
operation which becomes expensive when most of the
entries have been lazily deleted?
• WHAT sort requires a minrun length?
• If we know a problem can never be solved faster than a
given limit, we say it has a WHAT?
• An algorithm that has an average time complexity (as
contrasted with a worst case complexity) is termed WHAT
• A priority queue is stored as an array. Consider node at
subscript X. What is location of its parent? Assume X is
non-zero.
• A structure has nodes and edges. An edge can connect any
two nodes. WHAT is the data structure called?
• You notice slow retrieval from a hash table which uses
separate chaining. A found item takes an average of 3
probes, but it takes an average of 6 probes to determine an
item is not in the table. Which factor explains the cause of
the problem?
• A graph is stored as an adjacency matrix.
What is the expected number of operations
needed to visit all the predecessor nodes of a
particular vertex (Assume N vertices are in the
graph, E edges are in the graph, and M edges
actually begin at the desired node.)
• Two keys that hash onto the same location
originally compete for different successive
locations when resolving collisions. What
collision resolution method(s) has this
feature?
• Quicksort will run faster if you eliminate calls
when the array slice is small. Assume you have
already written a function partition which has the
following prototype:
• //Partition arranges the array arr slice between
subscripts left and right into a section
// that is greater than or equal to the pivot and a
section that is smaller than the pivot.
// The location where the pivot ended up is
returned.
int partition(int *arr, const int left, const int right)
• Write a version of quicksort which correctly sorts
the array but eliminates calls when the slice of the
array is smaller than 10.