日韩精品一区二区三区高清_久久国产热这里只有精品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>
        午夜欧美大尺度福利影院在线看| 欧美中文在线免费| 久久久之久亚州精品露出| 亚洲第一黄色| 欧美日韩一区二区三区视频| 欧美日韩另类一区| 一本一本久久a久久精品牛牛影视| 国产精品白丝黑袜喷水久久久| 亚洲乱码国产乱码精品精98午夜| 亚洲免费视频观看| 国产精品久久久一区二区| 91久久久久久久久久久久久| 欧美日韩亚洲一区在线观看| 亚洲一品av免费观看| 91久久一区二区| 亚洲激情小视频| 亚洲电影中文字幕| 久久国产精品一区二区三区| 久久久久国产精品麻豆ai换脸| 国产小视频国产精品| 欧美亚洲一区在线| 国产精品老牛| 欧美成人午夜影院| 免播放器亚洲| 欧美1区免费| 国产亚洲一本大道中文在线| 欧美本精品男人aⅴ天堂| 国产精品久久久久7777婷婷| 一区二区激情| 亚洲国产婷婷综合在线精品| 亚洲国产欧洲综合997久久| 久久亚洲国产精品日日av夜夜| 香港成人在线视频| 久久婷婷激情| 一区二区三区不卡视频在线观看| 亚洲尤物影院| 亚洲高清视频在线观看| 亚洲欧美综合一区| 亚洲福利av| 亚洲女人av| 久久精品官网| 欧美天天视频| 久久女同精品一区二区| 久久激情综合网| 亚洲国产91精品在线观看| 欧美ab在线视频| 国产亚洲欧美一区| 欧美国产第一页| 亚洲精品一区二区网址| 欧美激情亚洲一区| 国产噜噜噜噜噜久久久久久久久| 一区二区三区国产| 国产一区在线免费观看| 最新国产精品拍自在线播放| 国产精品男人爽免费视频1| 狠狠爱www人成狠狠爱综合网| 久久久久久999| 亚洲人体大胆视频| 国产精品国产亚洲精品看不卡15| 老司机成人在线视频| 在线观看亚洲视频啊啊啊啊| 国产欧美精品一区二区三区介绍| 亚洲欧美激情一区二区| 欧美风情在线观看| 国产人妖伪娘一区91| 黄色成人在线网站| 国产欧美一区二区精品婷婷| 99精品国产一区二区青青牛奶| 久久久综合香蕉尹人综合网| 亚洲深爱激情| 欧美日韩国产区| 国产毛片精品国产一区二区三区| 欧美国产一区二区三区激情无套| 亚洲欧美日韩在线播放| 欧美人妖在线观看| 亚洲精品国产品国语在线app| 久久精品一区蜜桃臀影院| 激情久久久久久久| 亚洲欧美在线另类| 亚洲电影免费在线观看| 国产精品久久波多野结衣| 一本色道久久综合狠狠躁篇怎么玩| 欧美91视频| 国产伦精品一区二区三区免费迷| 欧美日韩在线视频一区| 国产精品久久精品日日| 久久精彩视频| 欧美天堂在线观看| 久久riav二区三区| 亚洲国产欧美一区二区三区久久| 久久久久久97三级| 夜夜躁日日躁狠狠久久88av| 亚洲精品日韩激情在线电影| 精品成人在线| 蜜桃久久精品乱码一区二区| 国产欧美欧洲在线观看| 国产精品男人爽免费视频1| 欧美色道久久88综合亚洲精品| 亚洲区欧美区| 亚洲看片网站| 一区二区三区久久久| 亚洲欧美国产精品桃花| 欧美体内she精视频| 久久精品国产久精国产一老狼| 亚洲国产精品激情在线观看| 国产精品一区二区三区四区五区| 在线免费观看日本欧美| 久久国产精品99国产| 国产精品看片你懂得| 国产精品福利在线观看网址| 久久久蜜桃精品| 久久久噜噜噜久久中文字幕色伊伊| 欧美有码视频| 国产精品久久国产三级国电话系列| 国产伦精品一区二区三区在线观看| 亚洲第一在线视频| 性做久久久久久| 国产精品久久久久久久久动漫| 国内激情久久| 亚洲欧洲免费视频| 久久综合激情| 国产精品视频免费| 99香蕉国产精品偷在线观看| 欧美一区二区三区四区在线观看| 欧美乱大交xxxxx| 欧美bbbxxxxx| 亚洲一区三区视频在线观看| 激情国产一区| 激情久久久久久| 欧美成人一区二区三区| 一区二区高清| 久久精品视频在线观看| 伊人久久婷婷| 韩国av一区二区三区在线观看| 久久国产欧美| 一区二区精品在线| 亚洲第一网站| 国产精品草莓在线免费观看| 国产日韩精品一区| 精品成人国产| 国产亚洲欧美日韩精品| 久久久久久久久久久久久9999| 性欧美暴力猛交另类hd| 欧美日韩一区成人| 国产精品视频99| 免费成人高清视频| 国产精品嫩草影院一区二区| 国产欧美一区二区三区沐欲| 欧美精品97| 久久久国产精彩视频美女艺术照福利| 亚洲视频网在线直播| 99亚洲一区二区| 久久精品亚洲一区二区| 久久精品导航| 欧美日韩国产精品一区二区亚洲| 亚洲欧美精品在线| 久久国产精品电影| 久久久高清一区二区三区| 狠狠入ady亚洲精品| 亚洲国产99精品国自产| 国产乱人伦精品一区二区| 国产一区二区三区黄| 亚洲欧美区自拍先锋| 亚洲视频成人|