国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代寫B(tài)E205、代做C++語言程序
代寫B(tài)E205、代做C++語言程序

時(shí)間:2024-10-27  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



 Homework 1 – Complexities and Correctness
BE205: Algorithms and Data Structures
MUST 2024 Fall ∗ Tuesday October 01 2024
1 Introduction and Review
There are several themes of this course:
• Analyzing the complexity of a given algorithm (or a snippet). • Proving the correctness or flaw of an algorithm.
• Design an algorithm for solving a given problem.
• Implement an algorithm using C++ (or C).
So, there are problems to be solved on these aspects.
∗The picture above the title, found at [1], shows some basic understanding of the big O notations.
 1

2 How to submit the homework 2.1 Mathematical notations
Math notations are needed to write the answers to Problem 1. If you do not know how to edit math equations and notations using Word, Markdown, or Latex, you may use some easy-to-understand text form in a .txt file. For example, using ^ for superscript and _ for subscript, like:
• 2n+2 is described as 2^{n+2}.
• Σni=1i2 is described as Signma_{i=1}^{n}{i^2} • Θ(n2) is described as : \Theta(n^2)
• O(n log(n) is described as: O(n*log(n))
Pictures of clear hand writing can also be accepted.
2.2
• •
• •
2.3
1.
Submission method and deadline
Submit your homework files on Moodle through the portal of Assignment 1 (you can find it on the Moodle webpage of this course).
At most three students can form a group to do the homework together. Then, only one student should submit the files through the Moodle system.
You are welcome to do the homework again. I.e., a one-person group is surely fine.
The due time is about two weeks from the date of releasing the homeowork. The exact due time for this homework should refer to the setting of Assignment 1 on Moodle.
Files to be submitted
A report file hmk1_report. You can use the proper file format you can manage (.docx, .txt, .md, .pdf ...). This file should mention
• The full names of all the group members. Or you can say you did the homework alone.
• The tasks done by each member for this homework. This part is not needed if you did the homework alone.
• Anything meaningful that you want to document, like the difficulties and errors that you solved, some summary of the experience, etc. This part could help your future work.
• Answers to Problems 1, 2, 3.
2

2. A .zip file containing all the source code files for your programs of Problem 4. It is better to prepare two folders, one for the files of Problem 4.a, and the other for Problem 4.b. Then compress the two folders into the .zip file. Make sure your program files can compile. Do not include some project files of some IDE or executable files (.o, .exe. .obj. out). Just the source code files (.h, .c, .cpp, .txt) are fine.
Some specifics: about the files to be submitted.
• The answers to Problem 1 should clearly mention the snippet number, like:
             Answer for snippet (1): ..
             Answer for snippet (2): ...
3 Problems Problem 1
If you are sure, describe the upper bound of the complexity (running time relative to the problem size n) of the following code snippets using the Θ notation; otherwise, use the O notation. When log is used, the base should be 2.
(1) int sum = 0;
for (int i = 1; i < n; i *= 3)
++sum;
(2) int sum = 0;
for (int i = 0; i < n; ++i)
++sum;
for (int j = 0; j < n; ++j)
++sum;
(3) int sum = 0;
for (int i = 0; i < n; ++i)
for (int j = 1; j < n; j *= 2) ++sum;
(4) int sum = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) ++sum;
(5) int sum = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < i * i; ++j) 3

for (int k = 0; k < j; ++k) ++sum;
(6) int sum = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= 2n; ++j) { if (j % i == 2) {
for (int k = 0; k < j; ++k) { ++sum;
} }
} }
(7) int
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
for (int k = n; k >= 1; k = k / 2 )
++sum;
(8) int sum = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n + 1; ++j)
for (int k = 0, c = 1; k < j; ++k, c = c * 2)
for (int l = 0; l < c; ++l) ++sum;
Problem 2
Prove the correctness of the exponentiation-computing algorithm presented by pseudocode as follows. It was discussed in our lectures.
Require: n ≥ 0 Ensure: y = xn
1: 2: 3: 4: 5: 6: 7: 8: 9:
10:
y ← 1
X ← x
N ← n whileN̸=0do
if N is even then X←X×X
N ← N2
else if N is odd then
y←y×X N ← N − 1
▷ A comment: don’t forget to update N
sum = 0;
 4

8
9 10 11 12 13 14 15
} }
Hint: The correctness of this algorithm means that finally xn will always be the value y. One way is proving by induction some invariant of the loop, which means something is always true at each iteration of running the loop. The proof structure could like the following:
Lemma 1. An invariant: for each iteration, the statement . . . is true
Proof. Proof by induction:
Base case: In the first one, or several iterations the lemma is true, because . . .
Inductive step: Suppose in the previous k iterations, the statement is true, now we prove that for the k + 1th iteration it is also true. . . .
Theorem 1. Correctness of the exponentiation algorithm
Proof. Now based on the Lemma 1, the correctness of the algorithm should be true, because
....
Problem 3
The following algorithm is supposed to solve the Maximum Sum of Subsequence (MSS) problem. I t is mentioned in the textbook, described by a C++ program snippet. Prove the correctness of this algorithm.
 // Linear-time maximum contiguous subsequence sum algorithm.  Fig. 2.8 alg. 4
int maxSubSum4(const vector<int> &a) maxSum = 0, thisSum = 0;
(int j = 0; j < a.size(); ++j)
thisSum += a[j];
if (thisSum > maxSum) maxSum = thisSum; else if (thisSum < 0)
thisSum = 0; return maxSum;
1
2
3 4{
5 int
6 for
7{
Hint: The proof structure could similar to what are mentioned for Problem 2. An invari- ant can be proved. Based on it, the correctness must hold, because otherwise (proof by contradiction), something impossible will occur.
5

Problem 4
Problem 4.a
Given an array, sometimes we want to rotate its elements for some positions either to the right or left. For example. given an array with elements:
0, 11, 22, 33, 44, 55, 66, 77, 88, 99
if we rotate it to the right for 4 positions (shift is 4), then after doing so its elements will be print like:
66, 77, 88, 99, 0, 11, 22, 33, 44, 55
Or if we rotate it three positions to the left (shift is -3), its elements can be printed like:
33, 44, 55, 66, 77, 88, 99, 0, 11, 22
• There is an obvious way to "physically" rotate the elements in the array, just moving each element to its new position in the array after the rotation.
• Write a complete program where the a function with the following signature is imple- mented:
                  rotate(int * arrName, int arrLen, int shift)
• Do not use any library function for rotating or shifting an array.
• Test the function in a main function on an array with at least 10 elements. Test with at least 5 cases, for each case, use a different shift value (positive, 0, or negative, sometimes > 10 or < -11), and print the array before the rotation and after rotation.
• In this .cpp (or .c) file, besides the definition of the rotate function, describe as some comments about what is the time complexity of running this function.
Problem 4.b
We want to design some special array, call it Spin-and-Virtaul Array (SVArr), which has the following features: For the rotation task (make it ready to print its rotated elements), it can be done is a constant time (O(1)), instead of the "physical" way shown above. It is easy to know its size (the maximum number of elements can be stored in it). Out-of- boundary indexes are a not a problem. Increasing an index rotate to the right and touching the elements on the left end. Similarly, decreasing the index can rotate to the left and touch the elements on the right end. For example, given such an array arr with size 10:
**2; arr[9 + 1] == arr[0] **2; arr[7 + 5] == arr[2] **2; arr[−1] == arr[9] **2; arr[23] == arr[3]
6

**2; arr[−18] == arr[2]
It is a pain to move the elements of an array around, which are common operations in a sorting computation, specially, when an element has very large size. One idea is to have a change the "logical" indexes of the elements, instead of shuffling the of bit-sequences of array elements. For that purpose, a SV Array remembers two arrays:
• pArr, the "physical" array, the actual content of the data elements. This part does not change upon the actions like sorting or rotating.
• vArr, the "virtual-index" array, the logical indexes of the elements. This part will be updated by actions like sorting, or elements swapping.
For example, for an SVArr of 10 elements, initially, its two arrays are:
pArr 45 78 23 56 89 12 6**4 ** 55 vArr 0 1 2 3 4 5 6 7 8 9
After swapping 45 and 55, then the arrays changes to :
pArr 45 78 23 56 89 12 6**4 ** 55 vArr 9 1 2 3 4 5 6 7 1 0
After sorting the elements from small to large, the pArr does not change, while the vArr changes. Now, the two arrays become:
pArr 45 78 23 56 89 12 6**4 ** 55 vArr 5 2 7 0 9 3 6 1 4 8
Write a program to implement SVArr, with the following requirements:
• The style of ADT (abstract data type) should be expressed. So, SVArr should be a class, with public and private members. Some .h file and .cpp files should belong to the program.
• The main function test the following features of SVArr:
– An SVArr can be built based on a common array.
– Out-of-boundary indexes can be used; Print the value of these elements.
– Rotation can be done for positive and negative amount of shifting; Print the array before and after the shifting.
• The idea of O(1) time rotation should be implemented. Print the array after some rotation to see the effects.
• Show sorting on a SVArr, its virtual indexes changes while its physical array does not change.
7

• Do not use any library tools that have already implemented or covered the features of SVArr.
• The standard features of C++ classes should be used.
• If SVArr is implemented as a C++ template class, or some equivalent features sup- porting general types of elements, you deserve some bonus points. Otherwise, you can assume SVArr contains only integers.
• C programs are also accepted.
References
[1] Buket Senturk. Time complexity. https://medium.com/@buketsenturk/time-compl exity-202eb4f1db40, 2024. Accessed: 2024-10-01.
[2] Mark Allen Weiss. Data Structures and Algorithm Analysis in C++. Person, 4th edition, 2014. https://users.cs.fiu.edu/~weiss/.
A Helpful formulas
There are several formulas helpful to solve the Problem 1. 1+1+···+1=Σn 1=Θ(log(n))
(a+0d)+(a+1d)+(a+2d)+...+(a+(n−1)d) =
􏰀n
(a+(i−1)d) = na+d
i=1
(n − 1)n 2
2
12 ni=1i
n−1 1−rn a+ar+ar2+···+an−1 =􏰀ark =a1−r =Θ(rn−1)=Θ(rn)
= Θ(n )
  k=0
n n(n+1)(2n+1)
12 + 22 + · · · + n2 = 􏰀 i2 = S = 6 = Θ(n3) i=1
 Σni=1ik = Θ(nk+1) logk(n) = Θ(log2(n))
8

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp





 

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:AM05 AUT24代做、代寫R設(shè)計(jì)編程
  • 下一篇:代寫CS 205、代做C++程序設(shè)計(jì)
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 豆包網(wǎng)頁版入口 破天一劍 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    亚洲熟妇无码另类久久久| 精品免费国产一区二区| 免费看a级黄色片| 北条麻妃在线视频观看| 久久久久久久一区二区三区| 欧美精品久久久久久久| 欧美久久在线| 色婷婷综合久久久久| 一区二区国产日产| 国产精品一区二| 国产精品久久成人免费观看| 日本高清视频精品| 久久超碰亚洲| 亚洲 欧美 日韩 国产综合 在线| 福利视频一区二区三区四区| 久久九九热免费视频| 视频一区亚洲| 91久久精品美女高潮| 精品乱码一区二区三区| 蜜桃精品久久久久久久免费影院| 久久久久久久久久久久久久一区| 天堂资源在线亚洲视频| 久久综合色视频| 亚洲二区自拍| 国产高清av在线播放| 亚洲xxxx视频| 欧美精品久久| 国产精品区免费视频| 欧美亚洲另类制服自拍| 久久久精品网站| 欧美中文字幕在线观看视频| 婷婷亚洲婷婷综合色香五月| 久久久伊人日本| 欧美激情在线观看视频| 97免费高清电视剧观看| 一区二区日本伦理| 久久免费国产精品1| 性色av一区二区咪爱| 国产成人精品免费视频| 日本午夜精品一区二区| 久久99精品国产一区二区三区| 日韩一级免费在线观看| 日韩中文字幕av| 国产一区在线播放| 色与欲影视天天看综合网| 蜜桃成人免费视频| 亚洲图片在线观看| 91久热免费在线视频| 午夜精品久久久99热福利| 91福利视频在线观看| 日本高清视频精品| 久久精品99久久香蕉国产色戒| 欧美久久久久久久| 精品国产三级a∨在线| 亚洲av首页在线| 国产欧美日韩网站| 日本久久精品视频| 国产精品久久久久久久久久三级| 国产视频一区二区不卡| 久久99久久久久久久噜噜| 国产欧美日韩视频| 亚洲欧洲中文| 久久久久日韩精品久久久男男| 日韩欧美亚洲在线| 国产精品久久久久久久久久尿 | 国产精品欧美一区二区| 国产在线观看精品| 亚洲欧美日韩综合一区| 国产极品尤物在线| 免费黄色福利视频| 亚洲天堂电影网| 久久99精品久久久久久秒播放器| 国产专区欧美专区| 午夜精品一区二区三区在线| 国产精品美女在线播放| 国产欧美一区二区三区不卡高清| 日韩av在线第一页| 久久亚洲私人国产精品va| 国产激情美女久久久久久吹潮| 欧美精品久久96人妻无码| 国产精品视频白浆免费视频| 91精品国产91久久久久福利| 欧美精品第三页| 污污污污污污www网站免费| 久久激情五月丁香伊人| 91精品国产综合久久久久久蜜臀 | 国产欧美一区二区视频| 国产在线播放91| 国产精品一区视频| 国产精品天天狠天天看| 国产精品免费一区二区三区都可以| 久久国产精品久久久| 色综合久久精品亚洲国产 | 久无码久无码av无码| 久久人人97超碰人人澡爱香蕉| 97精品在线观看| 国产精品有限公司| 国产精品久久久久久久天堂 | 国产伦精品一区二区三毛| 日韩女优人人人人射在线视频| 久久久久久18| 国产精品激情av电影在线观看| 国产精品一区在线免费观看| 欧美资源一区| 欧美一级免费看| 欧美精品少妇videofree| 国产高清精品软男同| 欧美牲交a欧美牲交aⅴ免费下载| 亚洲国产精品www| 精品久久久久久综合日本| 久久久久久久久久久一区| 福利在线一区二区| 男女超爽视频免费播放| 日韩中文在线字幕| 亚洲精品免费av| 色综合天天狠天天透天天伊人| 国产精品极品美女在线观看免费| 国产成人在线视频| 97免费视频在线| 超碰免费在线公开| 国产原创中文在线观看| 国产专区一区二区| 青青在线视频一区二区三区| 日本午夜精品一区二区| 亚洲国产欧美日韩| 国产99视频精品免视看7| 国产精品久久久久久久小唯西川 | 亚洲**2019国产| 亚洲精品视频一区二区三区| 欧美激情a∨在线视频播放| 九色精品美女在线| 久久亚洲综合国产精品99麻豆精品福利| 久久综合福利| 97久久久久久| 99久久激情视频| 91精品国产九九九久久久亚洲| 成人精品一区二区三区电影免费| 欧美国产日韩在线播放| 日本一欧美一欧美一亚洲视频| 川上优av一区二区线观看| 色婷婷综合久久久久中文字幕| 亚洲成人网上| 日本一区免费看| 色婷婷精品国产一区二区三区| 亚洲黄色网址在线观看| 日本一区二区三区四区在线观看| 午夜精品短视频| 青青成人在线| 日韩精品在在线一区二区中文| 日日夜夜精品网站| 欧美一级淫片播放口| 午夜精品亚洲一区二区三区嫩草| 色999日韩自偷自拍美女| 日韩福利视频| 激情视频一区二区| 国产青春久久久国产毛片| 成人免费视频97| 99精品免费在线观看| 91精品国产91久久久久久最新| 99三级在线| 久久综合九色综合88i| 日韩一级特黄毛片| 国产精品老牛影院在线观看| 国产主播精品在线| 欧美一级欧美一级| 亚洲一区二区三区香蕉| 国产精品久久久久久超碰| 久久免费福利视频| 91高清免费在线观看| 国产精品亚洲一区二区三区| 麻豆91av| 国产日韩在线精品av| 男人的天堂99| 黄色片视频在线播放| 红桃一区二区三区| 僵尸世界大战2 在线播放| 亚洲午夜精品一区二区三区| 国产成人a亚洲精品| 91av在线播放| 国产精品久久久久久一区二区| 日本精品久久久久影院| 99精品99久久久久久宅男| 国模吧一区二区| 日韩av色在线| 欧洲精品国产| 国产精品视频一区二区三区经 | 午夜欧美性电影| 青青草原一区二区| 99精彩视频| www亚洲欧美| 久久av资源网站| 日本欧洲国产一区二区| 欧美日韩黄色一级片| 91国产在线精品| 国产精品青青在线观看爽香蕉| 日韩一级片免费视频| 黄色国产精品视频| 国产成人一区二区在线| 精品国产一区二区三区四区vr | 欧美亚洲日本黄色|