Find Jobs
Hire Freelancers

Bubble and selection sort

$5-10 USD

已关闭
已发布大约 22 年前

$5-10 USD

货到付款
You are to write a C++ program that will compare the execution times of the bubble sort and the selection sort. You are to use an improved version of the bubble sort as described in Exercise 4.11 on page 272 in the Deitel text. Likewise, you are to use a recursive implementation of the selection sort as described in Exercise 4.31 on page 281 of the Deitel text. Test each sort 3 times using an array of size 25,000: once with an array of random integers (use srand(0) when filling the array for the execution of both sorting algorithms so you will be able to verify that the sorts produce the same results and that the comparison of algorithms is “fair??), once with the array already sorted (fill the array with the values 0, 1, 2, …, 24999), and once with the array in reverse order (fill the array with the values 24999, 24998, 24997, …, 0). Time each execution of the sort (count only the sort time; don’t count the time to fill the array), displaying the execution time afterwards and also displaying the contents of the sorted array (starting with the first value in the array, display every 1000th value, 10 values per line). ## Deliverables SAMPLE EXECUTION (times will vary with speed of CPU): Execution time for improved bubble sort (random) = 7.11 seconds The sorted array (every 1000th entry) afterwards: 1 1338 2646 4017 5364 6669 8071 9379 10710 12006 13302 14624 15842 17124 18424 19732 21071 22399 23714 24971 26265 27530 28800 30097 31444 Execution time for improved bubble sort (sorted) = 0.00 seconds The sorted array (every 1000th entry) afterwards: 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000 23000 24000 Execution time for improved bubble sort (reverse sorted) = 8.21 seconds The sorted array (every 1000th entry) afterwards: 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000 23000 24000 Execution time for selection sort (random) = 3.89 seconds The sorted array (every 1000th entry) afterwards: 1 1338 2646 4017 5364 6669 8071 9379 10710 12006 13302 14624 15842 17124 18424 19732 21071 22399 23714 24971 26265 27530 28800 30097 31444 Execution time for selection sort (sorted) = 5.25 seconds The sorted array (every 1000th entry) afterwards: 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000 23000 24000 Execution time for selection sort (reverse sorted) = 4.59 seconds The sorted array (every 1000th entry) afterwards: 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000 23000 24000 Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. ## Platform must be done in visual c++ ## Deadline information must be done by 3/3/2002
项目 ID: 2840417

关于此项目

8提案
远程项目
活跃22 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
8威客以平均价$8 USD来参与此工作竞价
用户头像
See private message.
$5.10 USD 在14天之内
4.4 (72条评论)
5.5
5.5
用户头像
See private message.
$8.50 USD 在14天之内
5.0 (43条评论)
4.8
4.8
用户头像
See private message.
$8.50 USD 在14天之内
5.0 (26条评论)
3.8
3.8
用户头像
See private message.
$8.50 USD 在14天之内
4.5 (17条评论)
3.3
3.3
用户头像
See private message.
$8.50 USD 在14天之内
4.4 (6条评论)
1.6
1.6
用户头像
See private message.
$8.50 USD 在14天之内
5.0 (2条评论)
0.7
0.7
用户头像
See private message.
$8.50 USD 在14天之内
4.0 (2条评论)
0.5
0.5
用户头像
See private message.
$8.50 USD 在14天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
United States
0.0
0
会员自2月 18, 2002起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。