5 and 6
5. [2 marks] Can we do better than this? Recall that the human player is at some fixed location (px, py). Your task is to work out how you would sort the array A so that those enemy AIs that need to be marked can be identified in log(N) time. Specifically, complete the following comparison function that would be used while sorting the array A. Here, (x1, y1) and (x2, y2) are two points from the array A. The function should return true if it considers the first point to be less than or equal to the second, and should return false otherwise. Your function can use the player’s coordinate (px, py) as global variables, i.e. you are allowed to refer to px and py in your function. 2 function LessOrEqualTo((x1, y1),(x2, y2)) . . . 6. [3 marks] Now, supposing the array has been sorted using your comparison function, implement an algorithm whose worst case complexity is in Θ(log(N)) that determines which array elements should be marked. Your function should take the bound b as an argument, and may also take the player’s coorinates (px, py).
7 years ago
10
- At least 150 words Why do parents think they have no control over their children.
- Freshmen writing
- Microeconomic Theory
- PAD 520 WEEK 10 DISCUSSION (FOUR DIFFERENT ANSWER POSTED CHOOSE ANY)
- Pulmonary Case Study. Forum discussion
- ECET-402 Week 2 Lab Worksheet Acquiring Temperature & Signal Conditioning
- Strategic Management homework 1
- IT Management and Governance Issues
- Write a essay 2 pages
- for miss professor only