Find Jobs
Hire Freelancers

Unordered tree

$30-250 AUD

进行中
已发布大约 1 年前

$30-250 AUD

货到付款
I have to create two classes [login to view URL] that supports the following functions: - init (self): supports the following properties -root: Node - add_child(self, u: Node): Adds a new node to the tree as a child of the given node. The new node should have the next sequential id in the tree; that is, if you have n nodes in the tree, the new node should have id n+1. You are guaranteed that the given node is not already part of the tree. u: node to add a new child to. - min_pre_order_rank(self, u: Node): Finds the minimum pre-order rank of the given node. That is the lowest possible index in a pre-order traversal - attach((self, T: "Tree", u: Node): Attaches the given tree as a child to the given node, merging the two trees.T = tree to attach, u: = node to attach the tree to - pre_order(self, master_order: List[int]: Return the pre-order traversal of the tree given a master order. and [login to view URL]: which supports the following functions: - init(self, id: int) supports the following properties id: int children: List["Node"] parent: "Node" - add_child(self, u: "Node"): Adds the given node as a child of the current node. The given node is guaranteed to not be a child of any other node. - get_children(self): returns the children of the current node - get_parent(self): returns the parent of the current node - set_parent(self, u: "Node"): Sets the parent of the current node. u: = parent node Problem: Let T be an unordered tree (not necessarily binary) on n district integers keys. Because T is unordered, there can be multiple pre-order traversals (depending on how we iterate over the children of each node). ​ Example: in the tree ​ 1 / | \ / | \ 3 2 4 | | 5 two possible pre-order traversals could be: [1, 4, 3, 5, 2] (if we iterate over the children of 1 in [4, 3, 2]-order) or [1, 3, 5, 4, 2] (if we iterate over the children of 1 in [3, 4, 2]-order). Note, however, that if we were given a master order of all the nodes in the tree and we scanned the children of each node following this master order, then the pre-order traversal is uniquely defined by this master order. Example: in the tree ​ 1 / | \ / | \ 3 2 4 / \ / \ 5 6 [1, 2, 5, 6, 3, 4] is the pre-order traversal defined by the master order [5, 2, 3, 6, 4, 1], while [1, 4, 3, 2, 6, 5] is the pre-order traversal defined by the master order [6, 4, 3, 1, 2, 5]. For a given tree T and a master order M, we say that the pre-order M-rank of node x is k, if x is the kth node in the pre-order traversal defined by M.
项目 ID: 36320264

关于此项目

4提案
远程项目
活跃1 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
4威客以平均价$150 AUD来参与此工作竞价
用户头像
✔❤ Senior Software Developer ❤✔ Hello , Warm Greetings Senior Software Engineer highly experienced in Software Architecture, Engineering, UML Design, Algorithm and Python. I am senior software engineer with over 8 years of experience in Web/Software development. I have reviewed the project description and willing to accomplish this task. I have rich experience in Software Architecture, Engineering, UML Design, Algorithm and Python I always adhere to a results-driven approach to working with meticulous attention to detail, periodic thorough code reviews, and critical thinking. As an passionate and hard-working developer, I can complete your project within a given deadline. Top quality, accurate schedule, free and courteous after-sales service are what I guarantee to my customers. Ready to start the work immediately. Awaiting your Response Thanks and Regards
$155 AUD 在4天之内
5.0 (1条评论)
1.9
1.9
用户头像
@@@ Hello, @@@ I have read your job post carefully and sure I can finish this project perfectly. I have done many similiar projects successfully and have a reputation for providing only the highest quality work. I am very proficient with UML Design, Software Architecture, Python, Engineering and Algorithm and very confident to complete this project perfectly before deadline. Looking forward to discuss with you in detail via chat. Thanks, Vladyslav
$155 AUD 在6天之内
0.0 (0条评论)
0.0
0.0

关于客户

AUSTRALIA的国旗
Sydney, Australia
5.0
1
付款方式已验证
会员自4月 3, 2023起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。