加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫BE205、代做C++語言程序
代寫BE205、代做C++語言程序

時間:2024-10-27  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



 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





 

掃一掃在手機打開當前頁
  • 上一篇:AM05 AUT24代做、代寫R設計編程
  • 下一篇:代寫CS 205、代做C++程序設計
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    精品99在线| 久久婷婷国产| 黄色精品免费| 中文久久电影小说| 亚洲国产精品一区| 欧美aa免费在线| 亚洲一区二区毛片| 里番精品3d一二三区| 精品一区二区三区中文字幕在线 | 超碰aⅴ人人做人人爽欧美| 欧美精品一二| 99国产精品久久一区二区三区| 影音先锋久久精品| 成人免费一区| 在线看片国产福利你懂的| 欧美日韩高清| 日韩精品一区二区三区免费观影 | 自拍欧美一区| 国内毛片久久| 日韩在线视频一区二区三区| 国自产拍偷拍福利精品免费一| av亚洲一区二区三区| 色乱码一区二区三区网站| 北条麻妃一区二区三区在线| 国产一区二区三区四区大秀| 日日夜夜精品视频天天综合网| 日韩大片在线播放| 蜜桃91丨九色丨蝌蚪91桃色| 99视频在线精品国自产拍免费观看| 精品国产aⅴ| 精品国产三级| 日本少妇精品亚洲第一区| 亚洲伊人精品酒店| 亚洲精选成人| 国内精品嫩模av私拍在线观看| 成人黄色在线| 国产一区二区久久久久| 亚洲伦乱视频| 日韩在线综合| av亚洲一区二区三区| 日韩福利一区| 午夜欧美激情| av亚洲一区二区三区| 免费高潮视频95在线观看网站| 91视频综合| 蜜臀av性久久久久蜜臀aⅴ四虎 | 精品免费av一区二区三区| 亚洲国产福利| 日韩av中字| 亚洲精品69| 欧美v亚洲v综合v国产v仙踪林| 亚洲精品大全| 欧美亚洲一区二区三区| 欧美96一区二区免费视频| 一区二区三区福利| 日本女人一区二区三区| 日本成人在线视频网站| 欧美国产激情| 亚洲人成伊人成综合图片| 日韩av中文在线观看| 久久久久久久久成人| 日韩精品久久久久久久软件91| 日韩区一区二| 久久久久久久久国产一区| 亚洲图片在线| av成人国产| 国产精品久久久久久久| 欧美a级在线观看| 成人精品一区二区三区电影| 日本色综合中文字幕| 欧美日韩中出| 国产精品白丝av嫩草影院| 美女午夜精品| 波多野结衣在线观看一区二区三区| 日韩一级免费| 亚洲黄色免费av| 六月丁香婷婷色狠狠久久| 国产一区二区在线观| 日韩免费精品| 蜜桃一区二区三区| 国产精品美女久久久| 日韩欧美自拍| 亚洲麻豆av| 日韩中文字幕一区二区高清99| 久久久www| 久久国产99| 亚洲精品乱码日韩| 国产欧美69| 少妇久久久久| 免费观看久久久4p| 日本中文字幕视频一区| 国产精品毛片aⅴ一区二区三区 | 999精品视频在这里| 九一国产精品| 三级在线观看视频| 欧美区国产区| 美女视频亚洲色图| 国产精品丝袜xxxxxxx| 欧美一级免费| 欧美二区观看| 久久在线免费| 激情视频网站在线播放色| 日本sm残虐另类| 国产伦乱精品| 免费国产亚洲视频| 日韩高清不卡在线| 欧美色综合网| 丝袜美腿成人在线| 另类小说一区二区三区| 国产一区2区| 欧美在线影院| 久久精品国产福利| 亚洲3区在线| 丝袜亚洲另类欧美综合| 欧美a级一区二区| 青青一区二区| 人在线成免费视频| 国产在线一区不卡| 免费国产自久久久久三四区久久 | 中文国产一区| 一二三区精品| 蜜臀av一区| 日韩三区免费| 在线精品国产亚洲| 蜜臀av在线播放一区二区三区| 国产精品分类| 偷偷www综合久久久久久久| 福利一区在线| 欧洲亚洲一区二区三区| 亚洲欧美小说色综合小说一区| 99精品美女视频在线观看热舞| 伊人久久大香线蕉综合网蜜芽| 欧洲美女精品免费观看视频| 久久久久九九精品影院| 日本 国产 欧美色综合| 国产亚洲观看| 国产模特精品视频久久久久| 国产精品www.| 伊人狠狠色j香婷婷综合| 日韩国产成人精品| 欧美军人男男激情gay| 美女网站一区二区| 亚洲高清久久| 国产一区二区三区的电影 | 久久久久蜜桃| 久久激情综合网| 欧美色图在线播放| 日韩精品电影一区亚洲| 欧美日一区二区| 国产日韩欧美一区二区三区在线观看| 牲欧美videos精品| 一区二区毛片| 黄色成人精品网站| 国产精品1区| 蜜臀久久久久久久| 日本一区二区三区电影免费观看| 蜜桃av一区二区| 97视频一区| 少妇高潮一区二区三区99| 国产综合亚洲精品一区二| 国产精品激情电影| 久久国产88| 欧美色图麻豆| 一区二区毛片| 一本一道久久综合狠狠老精东影业| 成人污污视频| 日韩欧美不卡| 欧美一区视频| 99re8精品视频在线观看| 久久aⅴ国产紧身牛仔裤| 久久最新网址| 国产在线|日韩| 欧美ab在线视频| 电影一区中文字幕| 日本午夜大片a在线观看| 久久精品电影| 亚洲一区二区三区| 狠狠躁少妇一区二区三区| 91精品国产成人观看| 欧美国产日本| 日韩欧美不卡| 91久久亚洲| 日本亚洲三级在线| 色狠狠一区二区三区| 亚洲在线日韩| 欧美美女黄色| 亚洲网站三级| 经典三级一区二区| 欧美日韩精品| 日韩一区免费| 欧美黄在线观看| 日本精品不卡| 国产模特精品视频久久久久| 嗯用力啊快一点好舒服小柔久久| 麻豆成人免费电影| 日韩免费小视频| 最新日韩在线| 91精品国产成人观看| 亚洲春色h网| 国产精品久久久免费|