日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

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

代寫comp2123、代做Java/C++程序語言
代寫comp2123、代做Java/C++程序語言

時間:2025-03-29  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



comp2123 Assignment 2 s1 2025
This assignment is due on April 8 and should be submitted on Gradescope.
All submitted work must be done individually without consulting someone else’s
solutions in accordance with the University’s “Academic Dishonesty and Plagia rism” policies.
Before you read any further, go to the last page of this document and read
the Written Assignment Guidelines section.
Problem 1. (20 points)
Let T be a binary tree holding n distinct integer keys. A node u ∈ T is said to
be lucky if its key is smaller than its parent’s (if it has a parent) and its children’s
key (if it has any children).
Consider the following algorithm that tries to find a lucky node:
Algorithm 1
1: function FindLucky(T, u)
2: if u.le f t = Null and u.le f t.key < u.key then
3: return FindLucky(T, u.left)
4: if u.right = Null and u.right.key < u.key then
5: return FindLucky(T, u.right)
6: if u.parent = Null and u.parent.key < u.key then
7: return FindLucky(T, u.parent)
8: return u
When the input u is lucky then clearly f indlucky(T, u) returns a lucky node,
namely, u itself. But is it true that for all v ∈ T the function f indlucky(T, v)
always returns a lucky node?
Your task is to
Prove that for all v ∈ T the function f indlucky(T, v) returns a lucky node
or provide a counter example where it fails to return the correct answer.
a)
b) Provide a tight time complexity analysis of the algorithm when T is complete.
Problem 2. (40 points)
Bob Proverra is an apple farmer who maintains an orchard of apple trees. Unfor tunately for Bob, squirrels and birds have begun to infest his trees and eat all the
produce. To make matters worse, a disease has begun to strike some branches
of the trees, meaning they will no longer produce apples in the following year.
Through advanced cameras on the farm, Bob can produce high-quality im ages of the trees, which show him the number of apples on each branch, and
any sightings of squirrels or birds, as well as if any branches are diseased.
Using these images, your task is to design an algorithm to count the number
of apples on each tree and then rank the trees from healthiest to least healthy.
Keep note of the following criteria:
1
comp2123 Assignment 2 s1 2025
• If a branch contains a squirrel, any apples on that branch or higher branches
connected to it should only count for half, since the squirrel may eat some
(this effect compounds if there are more squirrels higher up in the tree).
• If a branch contains a bird, all apples in that tree count for 3
4
, since the bird
may eat some (this effect does not compound).
• The more diseased branches are sighted, the less healthy the tree is rated.
If only part of the branch has visible disease, the rest of the branch is still
considered to be diseased (from the point the disease is visible, until the
leaves of the tree).
Describe an efficient algorithm to count apples in Bob’s orchard, prove the
correctness and analyse the time complexity.
a)
Describe an efficient algorithm to order trees in Bob’s orchard by healthi ness. Note that that the number of apples a tree produced doesn’t affect
its health rating.
b)
Consider if Bob was to prune all of the diseased branches and separate
them from his crop. How would this affect his crop yield? Modify your
algorithm to consider this, giving Bob an idea of how much produce he can
expect to grow in the following year (assuming no new branches grow).
c)
Problem 3. (40 points)
Let T be a binary tree whose nodes store distinct numerical values. Consider the
following pair of operations on binary trees:
• Rotate an arbitrary node upward.
• Swap the left and right subtrees of an arbitrary node.
In both of these operations, some, all, or none of the subtrees A, B, and C
could be empty.
2
comp2123 Assignment 2 s1 2025
Figure 1: rotate 2, rotate 2, swap 3, rotate 3, rotate 4, swap 3, rotate 2, swap 4
Your task is to design an algorithm to transform an arbitrary n-node binary
tree with distinct node values into a binary search tree, using at most O(n
2
)
rotations and swaps.
Your algorithm is not allowed to directly modify parent or child pointers,
create new nodes, or delete old nodes; the only way to modify the tree is through
rotations and swaps.
On the other hand, you may compute anything you like for free, as long as
that computation does not modify the tree; the running time of your algorithm
is defined to be the number of rotations and swaps that it performs.
a) describe your algorithm in plain English,
b) prove it correctness, and
c) analyze its time complexity.
3
comp2123 Assignment 2 s1 2025
Written Assignment Guidelines
• Assignments should be typed and submitted as pdf (no pdf containing text
as images, no handwriting).
• Start by typing your student ID at the top of the first page of your submis sion. Do not type your name.
• Submit only your answers to the questions. Do not copy the questions.
• When asked to give a plain English description, describe your algorithm
as you would to a friend over the phone, such that you completely and
unambiguously describe your algorithm, including all the important (i.e.,
non-trivial) details. It often helps to give a very short (1-2 sentence) de scription of the overall idea, then to describe each step in detail. At the end
you can also include pseudocode, but this is optional.
• In particular, when designing an algorithm or data structure, it might help
you (and us) if you briefly describe your general idea, and after that you
might want to develop and elaborate on details. If we don’t see/under stand your general idea, we cannot give you marks for it.
• Be careful with giving multiple or alternative answers. If you give multiple
answers, then we will give you marks only for "your worst answer", as this
indicates how well you understood the question.
• Some of the questions are very easy (with the help of the slides or book).
You can use the material presented in the lecture or book without proving
it. You do not need to write more than necessary (see comment above).
• When giving answers to questions, always prove/explain/motivate your
answers.
• When giving an algorithm as an answer, the algorithm does not have to be
given as (pseudo-)code.
• If you do give (pseudo-)code, then you still have to explain your code and
your ideas in plain English.
• Unless otherwise stated, we always ask about worst-case analysis, worst case running times, etc.
• As done in the lecture, and as it is typical for an algorithms course, we
are interested in the most efficient algorithms and data structures, though
slower solutions may receive partial marks.
• If you use further resources (books, scientific papers, the internet,...) to
formulate your answers, then add references to your sources and explain it
in your own words. Only citing a source doesn’t show your understanding
and will thus get you very few (if any) marks. Copying from any source
without reference is considered plagiarism.
4

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

掃一掃在手機打開當前頁
  • 上一篇:comp2123代做、代寫c/c++,Python設計編程
  • 下一篇:菜鳥錢包強制下款怎么辦?如何聯系菜鳥錢包客服電話解決問題?
  • 無相關信息
    合肥生活資訊

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

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

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

    日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

      <em id="rw4ev"></em>

        <tr id="rw4ev"></tr>

        <nav id="rw4ev"></nav>
        <strike id="rw4ev"><pre id="rw4ev"></pre></strike>
        久久综合一区二区三区| 国产欧美日韩中文字幕在线| 尤物yw午夜国产精品视频明星| 国产精品视频最多的网站| 久久精品观看| 国产精品一区视频| 欧美一区日韩一区| 欧美精品激情在线观看| 亚洲看片一区| 久久久久久久一区二区三区| 国产精品久久久久9999| 国产精品视频免费观看| 亚洲美女少妇无套啪啪呻吟| 国产欧美一区视频| 亚洲国产精品成人| 欧美日韩精品高清| 亚洲福利一区| 国产精品一卡二卡| 韩国av一区二区三区四区| 伊人色综合久久天天五月婷| 欧美日韩日日骚| 欧美日韩在线视频首页| 国产亚洲欧美日韩在线一区| 亚洲免费视频中文字幕| 久久精品国产精品亚洲| 99精品国产福利在线观看免费| 久久精品理论片| 欧美久久久久中文字幕| 一区二区免费在线视频| 亚洲精品一区二区三区樱花| 亚洲精品欧美激情| 亚洲国产精品成人精品| 国产欧美日韩91| 欧美亚洲成人精品| 一区二区三区四区五区视频| 亚洲美女91| 麻豆av一区二区三区| 亚洲狠狠丁香婷婷综合久久久| 国产精品国产自产拍高清av| 欧美成年人视频网站| 国产精品人人做人人爽人人添| 久久精品国内一区二区三区| 国产伦精品一区| 国产精品海角社区在线观看| 欧美日韩国产高清视频| 欧美日韩日日夜夜| 亚洲视频在线观看视频| 91久久精品日日躁夜夜躁欧美| 国产一区二区日韩精品欧美精品| 亚洲欧洲视频在线| 亚洲国产岛国毛片在线| 99精品欧美一区二区蜜桃免费| 国产精品一区亚洲| 国内综合精品午夜久久资源| 一本色道88久久加勒比精品| 一区二区欧美激情| 亚洲美女免费精品视频在线观看| 国产精品成人va在线观看| 在线免费观看日本欧美| 久久久天天操| 麻豆视频一区二区| 亚洲欧美成人网| 久久国产成人| 亚洲精品综合久久中文字幕| 国产精品专区h在线观看| 国产精品高潮久久| 亚洲人成在线观看网站高清| 99国产精品久久久久久久| 亚洲激情视频在线播放| 欧美视频一区二区三区| 亚洲综合欧美| 欧美视频中文字幕| 亚洲精品美女久久久久| 香蕉精品999视频一区二区| 欧美1级日本1级| 国产精品久久久久久五月尺| 欧美精品二区| 欧美日韩在线视频一区二区| 亚洲精品视频在线播放| 欧美性大战xxxxx久久久| 鲁鲁狠狠狠7777一区二区| 韩国精品主播一区二区在线观看| 国产精品美女久久久久aⅴ国产馆| 欧美高清视频免费观看| 狠狠色2019综合网| 国产精品地址| 亚洲国产美女久久久久| 亚洲美女少妇无套啪啪呻吟| 99视频超级精品| 亚洲字幕在线观看| 欧美成人自拍视频| 午夜国产欧美理论在线播放| 日韩一区二区高清| 欧美激情视频免费观看| 亚洲美女视频在线免费观看| 亚洲黄色影院| 欧美福利在线观看| 欧美日韩亚洲在线| 亚洲国产精品久久久久秋霞不卡| 国产精品免费久久久久久| 亚洲国产另类 国产精品国产免费| 国产在线视频不卡二| 亚洲欧美自拍偷拍| 一色屋精品亚洲香蕉网站| 亚洲高清三级视频| 这里是久久伊人| 欧美日韩专区| 久久精品理论片| 91久久中文| 99亚洲视频| 久久蜜桃香蕉精品一区二区三区| 欧美精品久久久久久久久久| 欧美—级a级欧美特级ar全黄| 国产精品露脸自拍| 国产日本欧美一区二区三区在线| 久久国产免费| 亚洲你懂的在线视频| 欧美一级日韩一级| 欧美另类视频| 久久久久久成人| 亚洲视频精选| 欧美日韩国产a| 在线中文字幕一区| 欧美日韩在线播放三区四区| 国产在线不卡精品| 欧美大片在线观看一区| 蜜臀久久99精品久久久画质超高清| 精品成人一区二区| 欧美一区激情视频在线观看| 欧美日韩中文字幕| 欧美日韩免费观看中文| 欧美日韩一区二区在线观看视频| 亚洲国产天堂久久综合| 久久蜜桃av一区精品变态类天堂| 午夜精品三级视频福利| 一区二区日韩伦理片| 午夜精品视频在线| 亚洲午夜一区二区三区| 亚洲国产裸拍裸体视频在线观看乱了| 在线免费高清一区二区三区| 欧美性做爰毛片| 校园激情久久| 亚洲高清在线精品| 国产欧美日韩不卡免费| 欧美视频在线免费| 国产美女高潮久久白浆| 午夜精品久久久久久久99热浪潮| 亚洲欧洲偷拍精品| 亚洲欧美国产77777| 亚洲国产你懂的| 国产精品久久久久aaaa九色| 黑丝一区二区三区| 亚洲欧美日韩综合国产aⅴ| 欧美性生交xxxxx久久久| 国产精品一页| 国产精品自拍三区| 亚洲专区国产精品| 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品一级二级三级| 在线观看欧美激情| 久久一区激情| 欧美人与性动交a欧美精品| 国产精品久久久久久久久搜平片| 亚洲一二三四区|