99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

代寫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設計編程
  • 下一篇:菜鳥錢包強制下款怎么辦?如何聯系菜鳥錢包客服電話解決問題?
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          国产精品高潮在线| 99亚洲一区二区| 欧美日韩精品系列| 中文久久乱码一区二区| 一区精品久久| 国产精品―色哟哟| 欧美日韩成人在线播放| 久久久精品国产免费观看同学| 99精品99| 亚洲级视频在线观看免费1级| 国产精品久久中文| 欧美高清影院| 久久久青草婷婷精品综合日韩 | 久久精品99国产精品酒店日本| 亚洲激情偷拍| 国产视频精品va久久久久久| 欧美午夜一区二区福利视频| 欧美sm视频| 免费一级欧美片在线观看| 久久久噜噜噜久久| 欧美一级夜夜爽| 亚洲免费小视频| 亚洲免费视频网站| 一区二区三区产品免费精品久久75| 亚洲人成在线观看一区二区 | 久久久午夜精品| 久久久久看片| 麻豆精品在线播放| 免费在线一区二区| 欧美国产日韩一二三区| 欧美精品一区二区久久婷婷| 欧美日韩国产综合新一区| 欧美日韩一区二| 国产精品毛片高清在线完整版| 国产精品视频网址| 国产一区二区你懂的| 国语自产精品视频在线看抢先版结局 | 久久爱www.| 久久综合电影| 欧美日韩国产成人| 欧美午夜精品理论片a级大开眼界| 欧美乱在线观看| 国产精品vvv| 国产精品亚发布| 狠狠色综合一区二区| 亚洲区一区二| 午夜在线电影亚洲一区| 欧美巨乳在线观看| 国产精品天天看| 国内精品免费在线观看| 亚洲精品一区在线| 久久黄色影院| 国产精品人成在线观看免费 | 国产专区一区| 久久精品国语| 国产欧美日韩麻豆91| 亚洲精品美女免费| 欧美综合二区| 黑人操亚洲美女惩罚| 欧美专区在线播放| 国产日韩欧美日韩| 亚洲一区二区三区乱码aⅴ| 欧美日韩高清在线| 99国产精品国产精品毛片| 欧美精品 国产精品| 亚洲国产美女| 欧美极品在线播放| aa亚洲婷婷| 国产欧美一区二区白浆黑人| 亚洲午夜激情免费视频| 国产精品亚洲综合| 久久天天综合| 亚洲国产欧美在线人成| 欧美激情亚洲综合一区| 在线亚洲精品| 欧美日韩在线播放三区| 欧美怡红院视频| 伊人久久av导航| 国产精品大片| 裸体女人亚洲精品一区| 亚洲一区国产视频| 亚洲电影在线观看| 国产区日韩欧美| 欧美日韩1区2区3区| 欧美一二三区在线观看| 亚洲精品极品| 91久久精品一区| 国产一区二区三区四区五区美女| 欧美国产免费| 欧美mv日韩mv国产网站app| 久久精品一区二区三区不卡牛牛 | 国产专区一区| 国产欧美日韩在线| 国产欧美精品一区二区三区介绍 | 黄网站色欧美视频| 国产精品入口夜色视频大尺度 | 日韩一区二区精品| 亚洲精品裸体| 亚洲少妇中出一区| 亚洲天堂黄色| 午夜欧美精品| 久久综合免费视频影院| 欧美成人蜜桃| 国产精品s色| 国产主播一区二区三区| 在线看视频不卡| 一本色道久久| 久久riav二区三区| 狂野欧美一区| 国产精品日韩欧美一区二区| 国产情侣久久| 亚洲精品中文字幕在线| 午夜精品一区二区三区四区| 久久久www成人免费毛片麻豆| 久久夜色撩人精品| 国产精品乱码| 亚洲精品乱码久久久久久蜜桃麻豆 | 欧美网站大全在线观看| 国产午夜精品久久久| 夜夜夜久久久| 免费视频一区| 影音先锋亚洲电影| 亚洲综合色自拍一区| 欧美成黄导航| 在线免费观看欧美| 新片速递亚洲合集欧美合集| 国产精品v欧美精品v日韩精品| 在线播放亚洲| 久久久午夜电影| 激情婷婷亚洲| 欧美在线www| 国产最新精品精品你懂的| 一区二区三区精品国产| 欧美日韩亚洲国产一区| 亚洲精品一级| 欧美图区在线视频| 亚洲女同在线| 国产美女一区二区| 久久夜色精品国产亚洲aⅴ | 免费欧美电影| 亚洲高清激情| 欧美视频在线观看免费| 一本久道久久综合婷婷鲸鱼| 国产精品久久久999| 亚洲一区二区三区精品在线观看| 国产精品日韩久久久久| 久久久久国产精品一区二区| 韩国v欧美v日本v亚洲v| 欧美精品999| 亚洲制服少妇| 亚洲精品久久久蜜桃| 国产精品视频一二| 欧美日本二区| 欧美不卡一卡二卡免费版| 99re国产精品| 亚洲欧洲精品一区| 国产精品美女久久久久久免费| 久久精品国产在热久久 | 亚洲美女在线一区| 国产综合亚洲精品一区二| 欧美无砖砖区免费| 欧美77777| 久久蜜臀精品av| 久久爱www.| 久久精品国产77777蜜臀| 一区二区三区国产精品| 一本色道久久综合亚洲精品不| 激情五月婷婷综合| 在线精品观看| 亚洲人成在线观看网站高清| 伊人久久综合| 亚洲毛片av在线| 一本一本久久| 中文在线一区| 性做久久久久久| 久久精品国产一区二区电影| 久久麻豆一区二区| 蜜桃伊人久久| 欧美网站在线观看| 国产精品一区毛片| 国产一区二区久久| 91久久国产综合久久| 夜夜狂射影院欧美极品| 一区二区三区视频免费在线观看| 亚洲一区在线播放| 麻豆成人精品| 国产精品美女久久久久久免费| 国内精品视频一区| 亚洲免费观看在线观看| 欧美亚洲在线观看| 美女精品国产| 精品1区2区| 性欧美精品高清| 欧美18av| 国内精品一区二区三区| 在线视频你懂得一区二区三区| 久久精品国产亚洲aⅴ| 国产精品伦理| 一本在线高清不卡dvd | 久久一区二区三区超碰国产精品|