0% found this document useful (0 votes)
21 views

Discrete Mathematics - Chapter Algorithm Practical Work: Niversity of Cience and Echnology of Anoi Achelor

1. The document provides instructions for a practical work session on discrete mathematics algorithms from 1:30-4:00 PM. Students are asked to complete coding projects on their laptops and submit paper work with their name, ID, and signature. 2. Five coding problems are described: 1) using binary search to find a number's position in an ordered list, 2) comparing bubble sort and insertion sort comparisons, 3) using greedy algorithm to find coin change, 4) using greedy algorithm to schedule most talks in a single hall, 5) comparing linear and binary search comparisons to find a number's position.

Uploaded by

Minh Hiếu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Discrete Mathematics - Chapter Algorithm Practical Work: Niversity of Cience and Echnology of Anoi Achelor

1. The document provides instructions for a practical work session on discrete mathematics algorithms from 1:30-4:00 PM. Students are asked to complete coding projects on their laptops and submit paper work with their name, ID, and signature. 2. Five coding problems are described: 1) using binary search to find a number's position in an ordered list, 2) comparing bubble sort and insertion sort comparisons, 3) using greedy algorithm to find coin change, 4) using greedy algorithm to schedule most talks in a single hall, 5) comparing linear and binary search comparisons to find a number's position.

Uploaded by

Minh Hiếu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

U NIVERSITY OF S CIENCE AND T ECHNOLOGY OF H ANOI

B ACHELOR ICT

Discrete mathematics - Chapter Algorithm


practical work

Dr. Anh Tuan GIANG


December 28, 2018

ATTENTIONS
• Practical work duration: 13:30 - 16:00.

• Using your own laptop to complete the code, then writing down your solution to paper
with your full name, student ID and your signature. Submit your paper work to teacher
before getting out of the class.
Computer Projects: write programs with these inputs and outputs.

1 P ROBLEM 1
Given an ordered list of n distinct integers, determine the position of an integer in the list
using a binary search.

2 P ROBLEM 2
Given a list of integers, determine the number of comparisons used by the bubble sort and by
the insertion sort to sort this list.

3 P ROBLEM 3
Given an integer n, use the greedy algorithm to find the change for n cents using quarters,
dimes, nickels, and pennies.

1
4 P ROBLEM 4
Given the starting and ending times of n talks, use the appropriate greedy algorithm to sched-
ule the most talks possible in a single lecture hall.

5 P ROBLEM 5
Given an ordered list of n integers and an integer x in the list, find the number of comparisons
used to determine the position of x in the list using a linear search and using a binary search.

You might also like