1 / 20

Shark

Shark. 99703041 謝佳佑 99703043 蘇 柏瑋 97306011 黃泓彰. 830-Shark. Problem introduction Discussion Solution. Problem introduction. Problem There are several attacks by sharks. The local guardians are worried, so they decide to implement an automated shark detection.

jaegar
Télécharger la présentation

Shark

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Shark 99703041謝佳佑 99703043蘇柏瑋 97306011黃泓彰

  2. 830-Shark • Problem introduction • Discussion • Solution

  3. Problem introduction • Problem There are several attacks by sharks. The local guardians are worried, so they decide to implement an automated shark detection. Detection is rather sophisticated, since not all sea animals are sharks.

  4. Problem introduction • Sardine 沙丁魚

  5. Problem introduction • Mackerel 青魚

  6. Problem introduction • Salmon 鮭魚

  7. Problem introduction • Turtle 烏龜

  8. Problem introduction • Grouper 石斑魚

  9. Problem introduction • Dolphin 海豚

  10. Problem introduction • Shark 鯊魚

  11. Problem introduction • Whale 鯨魚

  12. Problem introduction • Input b...c.fgh... baabca.jkyyy ...bcak..yyy ....ca...yyy zzzzzz...uuu zzzzzz.s.uuu zzzzzzsssuuu .tttt.sssuuu ttttt.sssuuu .tttt.sss.u. .........hh. bbbb..fffhh. bbbb..fffhh. bbbbgggg.hh. bbbbgggg.ppp bbbbgggg.ppp • Output Sardines: 6 Mackerels: 3 Salmons: 2 Groupers: 3 Turtles: 1 Dolphins: 2 Whales: 1 Sharks: 3

  13. Discussion • Possible Solutions • Search for each kind of animal. • Search for an animal, then classify.

  14. Solution • Pseudo-code Input = char [m][n] IsVisited = bool [m][n] with initial value FALSE FOREACH point(i, j) in Input IF point(i, j) != ‘.’ AND NOT IsVisited[i][j] Get length Get width Visit all points, set to TRUE Classification ENDIF

  15. Solution • What’s problem? A Fin-on-the-top Shark!

  16. Solution • Time complexity • A total of k animals in an m * n matrix, each with length lk and width wk • c as a constant while classification • (mn – k) + k (Σ lk + Σ wk + c + Σ(lkwk)) = Θ(mnk)

  17. Solution • Time complexity • Worst case: All sardines • k = mn • (mn – k) + k (Σ lk + Σ wk + c + Σ(lkwk)) = 0 + (mn) (mn + mn + c + mn) = 3(mn)2 + cmn • Θ((mn)2)

  18. Solution • Time complexity • Best case: A extremely big whale (or turtle) • k = 1 • (mn – k) + k (Σ lk + Σ wk + c + Σ(lkwk)) = (mn - 1) + (m + n + c + mn) = 2mn + m + n + c - 1 • Θ(mn)

  19. Solution • Time complexity • 1 ≤ k ≤ mn • mn ≤ mnk ≤ (mn)2 • Θ(mnk)

  20. Solution • Result DEMO http://140.119.19.129:10080/

More Related