Sunday, September 28, 2014

Take home messages after talking with a libarian

How to find a paper related to MOOC?

It's better Go to the education database in UVA.

The topic list from UVA library -- http://guides.lib.virginia.edu/subjectguides

Topic Computer science --http://guides.lib.virginia.edu/content.php?pid=16870&sid=131270


The trick to use the keywords
1. After you search a roughly word, you may need find a keyword in su

2. we could use "Direct Export to RefWorks" to manage our papers

3. Use "Limiters - Scholarly (Peer Reviewed) Journals"
Add filter --"peer reviewed", and it will allow us to get papers with higher quality.

4. Use the subject message in one paper as the searching keywords

5. Search the keyword in subject message, title or abstract.

6. You could also search the paper by author's name and then from the result, you could see the research focus and find their proficient area.

7. If you want to search about the impactor rate for a certain journal or conference. You need find it here:

8. after your searching, you may find there is no available pdf version, you may consider about use other ways to search. For example, google, or ISBN number and so on.






Friday, September 19, 2014

Exchange two variables without usage of extra memory

Usually, when we want to exchange two variables, we would think of adding a temp variable. However, there is a way to avoiding the use of extra memory.

Example:
x =a, y = b

step 1:
x := x +y
x = a+b, y =b

step 2: 
y := x -y =(a+b) - b = a
x = a+b, y=a

step 3:
x := x - y = (a+b) - a = b
x = b, y=a  

The algorithm to initializing an array

Quick notes from website--http://eli.thegreenplace.net/2008/08/23/initializing-an-array-in-constant-time/

The problem

We want to use a very large array for some computations. When created, all the elements of this array have to be initialized to some value. We'll only use a few values from the array1, so we don't want the runtime of the algorithm to be dominated by the initialization time.
In other words, we want to create and access an initialized array in constant time2.
How can this be done ? (Hint: we may use extra memory)

Solution

For a n-element array (vec), we'll use two additional n-element arrays and a pointer3. The arrays are called from andto and the pointer is called top. init_val is the value we want to initialize the array with.
  1. When an element i from vec is accessed, we'll know whether it has been initialized iffrom[i] < top and to[from[i]] = i. If this condition is satisfied, we return vec[i]. Otherwise, we returninit_val.
  2. Initially, top is 0
  3. The array element i is first accessed by the code:
from[i] = top
to[top] = i
vec[i] = init_val
top++

Understanding the algorithm

Let's assume we want an array with size 10. This is the initial state of the array and helpers (X denotes a memory location with arbitrary contents):
vec:  X X X X X X X X X X
from: X X X X X X X X X X
to:   X X X X X X X X X X
top:  0
Since from and to contain unsigned values, the condition from[i] < top can never be true while top = 0. So all read accesses at this point will result in init_val.
Now suppose we write into the vector. Let's say vec[4] <- 3. According to the algorithm, the next state will be:
vec:  X X X X 3 X X X X X
from: X X X X 0 X X X X X
to:   4 X X X X X X X X X
top:  1
Now accesses to i = 4 will satisfy the conditions from[4] = 0 < 1 and to[from[4]] = 4, so the value of vec[4] can be returned. Accesses to other indices will fail, because the only i that will pass the from[i] < top is an i for whichfrom[i] = 0, but only i = 4 will also fulfill the second condition to[from[i]] = i.
Let's work through another step. Let's say we write vec[9] <- 6. The next state will be:
vec:  X X X X 3 X X X X 6
from: X X X X 0 X X X X 1
to:   4 9 X X X X X X X X
top:  2
Again, the accesses to initialized indices, i = 4, 9 will satisfy the conditions. Accesses to other indices will fail. Suppose for example an access to i = 7. Is from[7] < 2 ? Let's assume that by chance it is. It must be either 0 or 1 then. But for both, to points to the only really initialized fields, which are either 4 or 9, so the second condition will not be satisfied.
I hope it's now clear how to, from and top interact to ensure that only initialized values will be actually returned. They kind-of close a loop - i points to from, from points to to and to points back to i. top makes sure that the location into was already initialized by the algorithm. Since the relevant locations in from and to are always in a controlled state, this algorithm can never be fooled by random values that were just lying around in the memory.

Tuesday, September 16, 2014

Video or Text?

If you want to introduce about how female do in  Computer Science. Video may not be a best solution.

For example:
http://www.dotdiva.org/
http://www.dotdiva.org/profiles.html
Text is faster to be understood by some people. Offering both text and video would be better!