Discussion:
A5P2 Pseudo-code
(too old to reply)
Pavel Petrenko
2011-07-12 04:08:56 UTC
Permalink
For problem 2, part (a) and part (f), do we need to provide pseudo code?

Part (a) ask us to briefly describe an algorithm. I am unsure how brief
we need to be. For part (f), it asks us to give a high-level description
for an algorithm. Again, what does a high-level description consist of?

Also, when will the public tests be available?

Thank you in advance for the clarification.
Daniel S. Roche
2011-07-12 17:14:28 UTC
Permalink
Post by Pavel Petrenko
For problem 2, part (a) and part (f), do we need to provide pseudo code?
Read the top of the assignment.
Post by Pavel Petrenko
Part (a) ask us to briefly describe an algorithm. I am unsure how brief
we need to be. For part (f), it asks us to give a high-level description
for an algorithm. Again, what does a high-level description consist of?
The point is just to communicate the idea of your algorithms, and
convince the marker that you understand what to do. You do not need to
provide all the details in pseudocode. However, I emphasize that it
should be completely clear to the markers what your algorithm is doing.
If you are unsure, you can always provide more details to be safe.

For instance, a brief, high-level description of the normal skip-search
algorithm might be:
"Starting at the very left of the top list (L_h, where h is the height
of the skip-list), perform a linear search in this list to find all keys
that are less than k in this level. At the last key less than k, drop
down to the level below, and perform another linear search in the list
below. Keep performing drop-downs and linear searches on each level
until we reach the bottom level, L_0. Then return a stack containing the
last node less than k in each level, with the last node less than k in
L_0 at the top of the stack."

Note that this is a less detailed version than the pseudo-code in the
slides, but it still very clearly (I think) communicates what the
algorithm does, so that anyone familiar with the skip-list data
structure could understand it.
Post by Pavel Petrenko
Also, when will the public tests be available?
(I'll leave this for Patrick.)

-Dan Roche
CS 240 Instructor, Section 003
Scott Stewart
2011-07-19 01:20:55 UTC
Permalink
Post by Daniel S. Roche
Post by Pavel Petrenko
For problem 2, part (a) and part (f), do we need to provide pseudo code?
Read the top of the assignment.
Post by Pavel Petrenko
Part (a) ask us to briefly describe an algorithm. I am unsure how brief
we need to be. For part (f), it asks us to give a high-level description
for an algorithm. Again, what does a high-level description consist of?
The point is just to communicate the idea of your algorithms, and
convince the marker that you understand what to do. You do not need to
provide all the details in pseudocode. However, I emphasize that it
should be completely clear to the markers what your algorithm is doing.
If you are unsure, you can always provide more details to be safe.
For instance, a brief, high-level description of the normal skip-search
"Starting at the very left of the top list (L_h, where h is the height
of the skip-list), perform a linear search in this list to find all keys
that are less than k in this level. At the last key less than k, drop
down to the level below, and perform another linear search in the list
below. Keep performing drop-downs and linear searches on each level
until we reach the bottom level, L_0. Then return a stack containing the
last node less than k in each level, with the last node less than k in
L_0 at the top of the stack."
Note that this is a less detailed version than the pseudo-code in the
slides, but it still very clearly (I think) communicates what the
algorithm does, so that anyone familiar with the skip-list data
structure could understand it.
Post by Pavel Petrenko
Also, when will the public tests be available?
(I'll leave this for Patrick.)
-Dan Roche
CS 240 Instructor, Section 003
Why would the normal skip search algorithm be returning a stack. Isn't
it only supposed to return the last node less than k in L_0 since this
represents the largest KVP with key less than k?
cs240
2011-07-19 14:34:02 UTC
Permalink
Skip list search returns a stack so that the stack can be used for
insertion and deletion.
Post by Scott Stewart
Why would the normal skip search algorithm be returning a stack. Isn't
it only supposed to return the last node less than k in L_0 since this
represents the largest KVP with key less than k?
--
Patrick Lee
CS240 Tutor
Loading...