Algorithm Lab (03-10-19)-cum-Home Work.
Ashulia: Section C
Due Date: 07-10-19
Ashulia: Section C
Due Date: 07-10-19
Total Points: 15
----------------------------------------------------
1. Compare Between Bubble Sort and Selection Sort with source code.
2. Write a program to pass three integer values from one array(A) to another(B) using tower of hanoi algorithm.
3. Topological Sort(Graph Theory):
------------------------------------------
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is
only possible if other tasks have already been executed.
Input:
The input will consist of several instances of the problem. Each instance begins with a line containing
two integers, 1 ≤ n ≤ 100 and m. n is the number of tasks (numbered from 1 to n) and m is the number of
direct precedence relations between tasks. After this, there will be m lines with two integers i and j,
representing the fact that task i must be executed before task j.
An instance with n = m = 0 will finish the input.
Output :
For each instance, print a line with n integers representing the tasks in a possible order of execution.
Sample Input
----------------
5 4
1 2
2 3
1 3
1 5
0 0
Sample Output
1 4 2 5 3
----------------------------------------------------
1. Compare Between Bubble Sort and Selection Sort with source code.
2. Write a program to pass three integer values from one array(A) to another(B) using tower of hanoi algorithm.
3. Topological Sort(Graph Theory):
------------------------------------------
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is
only possible if other tasks have already been executed.
Input:
The input will consist of several instances of the problem. Each instance begins with a line containing
two integers, 1 ≤ n ≤ 100 and m. n is the number of tasks (numbered from 1 to n) and m is the number of
direct precedence relations between tasks. After this, there will be m lines with two integers i and j,
representing the fact that task i must be executed before task j.
An instance with n = m = 0 will finish the input.
Output :
For each instance, print a line with n integers representing the tasks in a possible order of execution.
Sample Input
----------------
5 4
1 2
2 3
1 3
1 5
0 0
Sample Output
1 4 2 5 3
Name:Alex Purification
ReplyDeleteID:201830012
Drive Link:
https://drive.google.com/drive/folders/1689nfQoqJho0GA1N7f3db8iECSYzgtHa
This comment has been removed by the author.
ReplyDeleteName: Roy D Gregori Ayon
ReplyDeleteID: 201830011
https://drive.google.com/drive/folders/1wtSg0BLfy3yNY2ueHInwgPevkFvjMHR-
Name: Md. Rabiul Islam
ReplyDeleteID: 201810176
H/W Link:
https://drive.google.com/drive/folders/1RyuYglPeQpNuimhgKVU4-Nt5xSTp7LD2
ID:201730760
ReplyDeleteMd.Johirul Islam
problem no 1: http://ideone.com/W7FdQR
problem no 2: http://ideone.com/W64qzI
pronlem no 3: http://ideone.com/9Yze9K
This comment has been removed by the author.
ReplyDeleteName:Sanaullah Rabbi
ReplyDeleteID:201830123
Comparison: https://drive.google.com/openid=1IFMvYNxEz5Kx2mXjnJDg1eSdPfjCyu57
Topsort:
https://drive.google.com/openid=1QBtNKcsmTjhvD3shbmGUp2jc5E8CbsGq
hanoi:
https://drive.google.com/openid=1PR3lm82PTDdv0v6BmzPnG99PehgvXbg5
Name: Shamima Akter
ReplyDeleteID: 201830112
GDRIVE link: https://drive.google.com/open?id=1w2mmfW7qU_N2MPX24YOW_P69Jd8kXRUF