New version page

UConn CSE 2102 - Lab #2

Documents in this Course
Load more
Upgrade to remove ads

This preview shows page 1 out of 2 pages.

View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

CSE 3100 Systems Programming Fall 2018Lab #2Welcome to Lab 2! This lab assignment is due 36 hours after your lab session starts. For example,if your lab session starts at 8am on Friday, the assignment is due at 8pm on Saturday. Note that you have36 hours in this lab.Read each question carefully before beginning work. Start by executing git pull inside your Git repos-itory on the virtual machine. This will create a directory called lab2 which includes code provided for thislab. Note that a Makefile is provided. Please study the new features introduced in the file.Do all your work inside the lab2 directory. Remember to add, commit, and push when you completeyour work. Add ONLY *.c, and ex1-readme to the git repo. Do not add .o files or executables.Part 1. gdb. In this lab, you will learn how to use a debugger on the command line to squash bugs inC programs. At the beginning of the lab, your TA will give an introduction to gdb, The GNU ProjectDebugger. This introduction will be relatively brief and cover only a small fraction of what GDB has tooffer. For those interested in learning more, a complete guide to GDB can be found at There are also numerous other resources online.Find and fix all syntax errors and bugs in ex11-for.c and ex12-factorial.c. Submit your changesalong with the ex1-readme file detailing the errors/bugs you found. Both programs should be fixable withonly a few modifications. Complete rewrites of any of the programs will not be considered correctsolutions.Part 2. Catalan numbers. The sequence of the Catalan numbers Cn, where n ≥ 0, can be defined usingthe following recurrence:C0= 1Ck=4k − 2k + 1Ck−1if k ≥ 1Complete the catalan number() function in catalan.c. This function must compute Catalan numbersusing recursion. The main function prints C (0) through C (33) by calling catalan number() within a loop.Do not change it. Your task is limited to the catalan number() function. Do not print anything in thefunction. Do not use floating-point numbers or operations in your implementation. You must use the aboverecurrence for computing Catalan numbers, do not use other methods.Execution of the program after completing the function must produce the output listed below:$ ./catalanC( 0)= 1C( 1)= 1C( 2)= 2C( 3)= 5C( 4)= 14C( 5)= 42C( 6)= 132C( 7)= 429C( 8)= 1430C( 9)= 4862C(10)= 16796C(11)= 58786C(12)= 208012C(13)= 742900C(14)= 26744401C(15)= 9694845C(16)= 35357670C(17)= 129644790C(18)= 477638700C(19)= 1767263190C(20)= 6564120420C(21)= 24466267020C(22)= 91482563640C(23)= 343059613650C(24)= 1289904147324C(25)= 4861946401452C(26)= 18367353072152C(27)= 69533550916004C(28)= 263747951750360C(29)= 1002242216651368C(30)= 3814986502092304C(31)= 14544636039226909C(32)=

View Full Document
Download Lab #2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...

Join to view Lab #2 and access 3M+ class-specific study document.

We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab #2 2 2 and access 3M+ class-specific study document.


By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?