Assignments
DATE
ASSIGNMENT
SOLUTION
EX 1
Thu, Jun 25
- Write a small C program from scratch with multiple functions.
- Parse command-line arguments and convert C-strings to numbers.
- Read C library documentation and use the linter and valgrind to clean up your code.
EX 2
Thu, Jul 02
- Write code that uses pointers and data representations.
- Examine the relationship between pointers and arrays.
- Use format specifiers to handle printing fixed-width integers.
EX 3
Wed, Jul 08
- Define and use structs with typedef.
- Use malloc and free to manage dynamically-allocated data without memory leaks.
- Write some basic automated tests in C.
- Modularize a C program across multiple files.
HW 1
Thu, Jul 09
- Implement a doubly-linked list in C.
- Implement a chained hash table in C.
- Practice manual memory management with malloc and free.
- Debug pointer-heavy code with gdb and valgrind.
EX 4
Fri, Jul 17
- Read a file's size and contents using only POSIX I/O (open/read/lseek/close).
- Handle short reads and errors from read(), cleaning up resources on every path.
- Implement a directory iterator module using the POSIX dirent API.
- Measure how read granularity affects file I/O performance.
- Call C modules from a C++ client.
EX 5
Wed, Jul 22
- Write a C++ class from scratch: data members, methods, access specifiers, constructors, and a destructor.
- Define the behavior of standard operators for a user-defined class.
- Use dynamic memory allocation in C++ without causing memory leaks (the Rule of Three).
- Make design decisions about a C++ class, including member, non-member, and friend non-member functions.
- Create and use a C++ namespace.
HW 2
Thu, Jul 23
- Read a file into memory and parse its text into words with byte-offset positions.
- Recursively crawl a directory tree and index the text files it contains.
- Build an in-memory inverted index that maps words to per-document posting lists.
- Implement a console search shell that ranks and returns documents matching a query.
- Reuse and compose the HW1 LinkedList and HashTable modules while managing memory with malloc/free.
EX 6
Thu, Jul 30
- Use C++ streams to read files.
- Use C++ STL containers (e.g., map).
- Write templatized C++ code.
EX 7
Wed, Aug 05
- Define a class that inherits from and implements an abstract class.
- Evaluate a situation to figure out what smart pointers to use.
- Utilize smart pointers to manage complex memory structures.
HW 3
Thu, Aug 06
- Serialize an in-memory inverted index to disk in a portable, big-endian, architecture-neutral binary format.
- Read on-disk hash-table structures by following byte offsets through an index file.
- Implement C++ classes (constructors, inheritance, and member functions) that service word and document lookups against an index file.
- Build a query processor that searches across multiple on-disk indices and ranks the combined results.
- Use Verify333() checks and valgrind to write robust, leak-free C++ that manipulates on-disk data.
EX 8
Fri, Aug 14
- Adapt client-side networking code (TCP) in C/C++.
- Use the utility netcat (nc) to interact with clients over the network.
HW 4
Thu, Aug 20
- Use POSIX sockets to create a server that accepts IPv4 and IPv6 client connections.
- Parse HTTP requests from a byte stream, including partial reads and multiple requests on one connection.
- Use a thread pool to process concurrent client connections and coordinate graceful server shutdown.
- Integrate the HW3 query processor into a web server that generates HTTP responses and serves static files.
- Prevent cross-site scripting and directory traversal attacks by escaping untrusted input and validating file paths.