首页 新闻 聚焦 科技 财经 创业 综合 图片 视频

IT界

旗下栏目: 行业 生态 IT界 创新

代写COMP SCI编程、代做Algorithm

来源:互联网 发布时间:2021-06-22
代写COMP SCI编程、代做Algorithm
COMP SCI 2201 & 7201 Algorithm and Data Structure Analysis Semester 1, 2021
Minimum Spanning Trees, Euler Path, Undecidable
Problems, and Turing Machines
Exercise 1 Kruskal’s Algorithm
Compute a minimum Spanning for the following graph using Kruskal’s algorithm. Show
the status of your partial minimum spanning tree after each edge insertion and indicate
for each edge whether it is included in the minimum spanning tree.
Tutorial 5: Hashtables and Topological Sorting
General Instructions
You do not need to submit your solution. We will discuss the questions during the
workshop sessions in week 10.
Exercise 1 Hash Tables
1. Insert the key sequence 7, 18, 2, 3, 14, 25, 1, 11, 12, 1332 with hashing by chaining
in a hash table with size 11. Please show the final table by using the hash function
h(k) = k mod 11.
2. Please show the final table if we use linear probing instead.
3. Investigate by yourself what is “quadratic probing” and “double hashing”. Both
can be considered improved versions of linear probing. Please find out where they
improve upon linear probing.
Exercise 2 Single-source-shortest path problem in acyclic graphs
We consider the single-source-shortest path problem of a given directed graph G = (V,E)
with non-negative edge weights and a source node s. Furthermore, we assume that the
given graph G is acyclic, i. e. it does not contain a cycle.
? Give an algorithm (in pseudo-code) that solves the single-source-shortest path prob-
lem for a given acyclic graph in time O(m + n).
? Prove the correctness of your algorithm.
? Explain why your algorithm runs in time O(m + n).
End of Questions
Exercise 2 Euler tours of directed graphs
A Hamiltonian tour is a tour that visits every node of a strongly directed graph just once.
Determining if a Hamiltonian tour exists is an NP-Complete problem.
In contrast an Euler tour of a Strongly connected directed graph G = (V,E) is a cycle
that traverses each edge of G exactly once, although it may visit a node more than once.
Answer the following questions:
? Show that G has an Euler tour if and only if the in-degree of every node v equals
the out degree of v.
? Describe an O(m) (where m is the number of edges in G) algorithm to find an Euler
tour of G if such a tour exists (Hint: Merge edge-disjoint cycles).
1
COMP SCI 2201 & 7201 Algorithm and Data Structure Analysis Semester 1, 2021
Exercise 3 We define the following program: Does program Q, given input y, print either
”Hello world” or ”Goodbye world” as its first output?
Use reduction to prove that the above program is undecidable.
Exercise 4 On https://turingmachine.io/, implement the Turing machine that tests
whether the input is a UoA ID. That is, whether the input starts with a, and is then
followed by 7 digits.
Tutorial 5: Hashtables and Topological Sorting
General Instructions
You do not need to submit your solution. We will discuss the questions during the
workshop sessions in week 10.
Exercise 1 Hash Tables
1. Insert the key Sequence 7, 18, 2, 3, 14, 25, 1, 11, 12, 1332 with hashing by chaining
in a hash table with size 11. Please show the final table by using the hash function
h(k) = k mod 11.
2. Please show the final table if we use linear probing instead.
3. Investigate by yourself what is “quadratic probing” and “double hashing”. Both
can be considered improved versions of linear probing. Please find out where they
improve upon linear probing.
Exercise 2 Single-source-shortest path problem in acyclic graphs
We consider the single-source-shortest path problem of a given directed graph G = (V,E)
with non-negative edge weights and a source node s. Furthermore, we assume that the
given graph G is acyclic, i. e. it does not contain a cycle.
? Give an algorithm (in pseudo-code) that solves the single-source-shortest path prob-
lem for a given acyclic graph in time O(m + n).
? Prove the correctness of your algorithm.
? Explain why your Algorithm runs in time O(m + n).
End of Questions
 
请加QQ:99515681 或邮箱:99515681@qq.com   WX:codehelp
  免责声明:珠穆朗玛网对于有关本网站的任何内容、信息或广告,不声明或保证其正确性或可靠性,用户自行承担使用网站信息发布内容的真假风险。
责任编辑:珠穆朗玛网