Skip to content

Anushka23ja/CSS342-Data-Structures-Algorithms-and-Discrete-Mathematics-I

Repository files navigation

LABS completed through CSS 342 course at University of Washington

LAB 1: TimeSpan

📌Learning Objective: Constructors, Operators, Stream I/O, Encapsulation and Abstraction

Designed and implemented a TimeSpan class which represents a duration of time in hours, minutes, and seconds. The order hours, minutes, and seconds should be respected in the constructor. As an example TimeSpan duration(1, 2, 3); is a duration of time of 1 hour, 2 minutes and 3 seconds.

LAB 2: Recursion

📌Learning Objective: Catalan number problem, Tower of Hanoi

Catalan number problem

Wrote a program called Catalan which takes one argument and calls a recursive function which computes the nth Catalan number. The program then prints out the result to std::out. In this problem requires the utilization of command line arguments. For instance, Catalan 4 Would print out: 14 Catalan 10 Would print out: 16796

Tower of Hanoi

Implemented a recursive algorithm for the solution of the Tower of Hanoi using n disks and using 3 rods, labeled A, B, and C. Call the function “hanoiMoves” and it has 4 input parameters: n (number of disks), from, to, and extra. The last three are strings (A, B, C) representing the rods. Keep track of the number of moves (counter), and the elapsed time in microseconds. Demonstrates the moves to be taken for n=3. The output for n=3 should have the following form (the function call in main is hanoiMoves (3,'A', 'C', 'B')):

LAB 3:

📌Learning Objective: Sorting algorithms,demonstrate the cost of O(n2) v. O(n logn) algorithms, show that algorithms with the same complexity may have different running times

Wrote a program which implements the following sorts and compares the performance for operations on arrays of integers of growing sizes (e.g., 10k, for k=1, 2, 3,...). It is recommended that you use vectors of integers instead of arrays. The word “array” would be used to describe a list of integers from here on. Graph the performance of the different sorts as a function of the size of the array

LAB 4: The List

📌Learning Objective: Dynamic memory, Pointers, Linked lists, File IO, templates, operator overloading, overloading, copy constructors

Built a class for a fully ordered list. The list class, called LinkedList, will be templatized so that different types of objects can be stored in it.

LinkedList aListofStrings;

LinkedList aListofInts;

LinkedList children;

LinkedList myRO;

About

CSS342 Course completed through University of Washington

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages