Algorithms -- 2009-2010 -- info.uvt.ro/Laboratory 5

From Wikiversity

Quick links: front; laboratories agenda, 1, 2, 3, 4, 5, 6, 7, evaluation, tools, references.

Notes[edit]

Exercises[edit]

From the previous problem set:

  • problem 3: implementation of count sort;
  • problem 4: implementation of radix sort;
  • problem 5: generating permutations in lexicographical order;

Assignment[edit]

For submission please follow: assignment 4.

Problems 1-3[edit]

From the previous exercises, all problems.

Problem 4[edit]

Generation of permutations by using a recursive function, described in the 7'th lecture in English or 7'th lecture in Romanian (from professor Daniela Zaharie).

Problem 5[edit]

Sort a list of dates in increasing order (by year, month and then day), by using a variant of radix-sort.

def sort_dates (l) :
    ...
    return r

l = [(2009, 11, 23), (2008, 7, 31), (2010, 6, 29)]
r = sort_dates (l)
print r
# we should see [(2008, 7, 31), (2009, 11, 23), (2010, 6, 29)]

Ciprian Dorin Crăciun, ccraciun@info.uvt.ro