View on GitHub


This is the lab related content for the module CS2040C (Data structures and Algorithms)

Lab 01

Here is a pdf version of the ppt I covered during the lab. And the codes that I (skimmed through) / (demonstrated live).

content.pdf (The pdf version of the ppt shown)

vectors.cpp (in-built functions of vectors and algorithms)

strings.cpp (in-built functions of strings and algorithms)

sideways_sorting.cpp (Solution to this problem)

Challenge Questions -

Q) Given a string, check if it is a palindrome or NOT without using any kind of loops / goto / recursive statements.

Solution Use reverse(s.begin(), s.end()), where s is the string.

Q) Given a list of names, how would you sort these names in alphabetical order ?

Solution Push all the names as strings in a vector<string> V, then use sort(V.begin(), V.end())