0% found this document useful (0 votes)
48 views2 pages

Algorithms and Data Structures: Labwork 4 - Recursion

The document provides instructions for students to complete 4 exercises on recursion as part of an algorithms and data structures lab. Students must submit zip files with their code for each exercise within one week. Files must be named according to the specified format and only include source code files. Copying or pasting code is not allowed and will result in penalties. The exercises include writing recursive functions to multiply integers, find prime numbers, calculate the sum of a linked list, and find the least bills for a given money amount. An optional bonus exercise involves solving the Hanoi tower problem using stacks and linked lists.

Uploaded by

Minh Hiếu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Algorithms and Data Structures: Labwork 4 - Recursion

The document provides instructions for students to complete 4 exercises on recursion as part of an algorithms and data structures lab. Students must submit zip files with their code for each exercise within one week. Files must be named according to the specified format and only include source code files. Copying or pasting code is not allowed and will result in penalties. The exercises include writing recursive functions to multiply integers, find prime numbers, calculate the sum of a linked list, and find the least bills for a given money amount. An optional bonus exercise involves solving the Hanoi tower problem using stacks and linked lists.

Uploaded by

Minh Hiếu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

University of Science and Technology of Hanoi

Address: USTH Building, 18 Hoang Quoc


Viet, Cau Giay, Hanoi

Algorithms and data structures


Labwork 4 - Recursion

Dr. Doan Nhat Quang: [email protected]

Follow the below guide:

• After a labwork, you will have one week (or 7 days) to complete all exercises.
All submissions must be sent before 23:59 of the day before the next labwork
day.

• Compress all code source files in a zip file and rename it as FULLNAME-ID-
TT#no.zip (e.g NguyenVanA-070-TT1.zip). Save your files according to the
exercise number i.e Ex1.cpp, Ex2.c, etc.

• Only code source files (.c or .cpp) should be in the zip files. Other files (.exe,
.o) MUST be removed from the zip file.

• Send to this email: [email protected]

• Copy/Paste from any source is not tolerated. Penalty will be applied for late
submission.

• NOTE: You must follow the guide. Incorrect zip file name, zip files containing
other files (.exe), copy/paste lead to heavy penalty (no score).

Exercise 1:
Write a program in C/C++ that uses only addition, subtraction, and comparison
to multiply two interger numbers using recursion.

Exercise 2:
Write a program in C/C++ to find prime numbers from 1 to n using recursion (with
iteration if necessary) where n is a natural number.

Exercise 3:
Write a recursive function in C/C++ that calculates the sum of all elements in a
Linked List.

1
Exercise 4:
Write a recursive function in C/C++ that finds the least bills of a given money
amount. We suppose that there are 6 different bills in the currency system: 1$ bill,
2$ bill, 5 $ bill, 10$ bill, 20$ bill, 50 $ bill.

Exercise Bonus:
Write a program in C/C++ to solve the Hanoi tower using Stacks with the Linked
List implementation. The mission is to move all the disks to some another tower
without violating the sequence of arrangement and with few rules as following:

• Only one disk can be moved among the towers at any given time.

• Only the top disk can be removed.

• No large disk can be put over a small disk.

You might also like