A queue is a good data structure for conducting a

This preview shows page 5 - 8 out of 8 pages.

A queue is a good data structure for conducting a level-order traversal of a binary tree
EECS 281: Lab 9 AssignmentPage 5
9.15 - Memory Trees (1 point)Suppose you have a binary tree of height 281, where leaf nodes have height 1, and you want to search for anelementk. You know thatkexists as a distinct element in this tree, and that it is a leaf node. Which of the followingstatements is/aretrue? Select all that apply.
EECS 281: Lab 9 AssignmentPage 6
Part D: Coding Assignment (10 points)9.16 - Number of Islands (10 points)In this problem, you will be implementing thenumber_of_islands()function, as shown below:intnumber_of_islands(std::vector<std::vector<char>>&grid);This function takes in a 2-D grid map filled with land (represented using the character'o') and water (representedusing the character'.') andreturns the number of islands that exist in the map.An island is formed by connectingadjacent land characters either horizontally or vertically. In other words, if two land characters are adjacent to eachother horizontally or vertically, then they are a part of the same island.Example:Given the following 2-D map:o...oo.ooo.ooooo..ooo.oo..oo..oooo...o.o.ooo.....oooo.ooo..oooo..o..o....o....ooooo.oooo....oooo....oo....ooooo...ooo.oooo.oo.oooo.o.ooo.ooo....oo......o...oooooo...oo.oothenumber_of_islands()function should return 7, since there are 7 islands in this map:o...oo.ooo.ooooo..ooo.oo..oo..oooo...o.o.ooo.....oooo.ooo..oooo..o..o....o....ooooo.oooo....oooo....oo....ooooo...ooo.oooo.oo.oooo.o.ooo.ooo....oo......o...oooooo...oo.ooImplement your solution in theislands.hstarter file provided. You can download the file on either Canvas orGitLab.To submit to the autograder, create a.tar.gzfile containing justislands.hby running the following command:tar -czvf lab9.tar.gz islands.h(you can also run "make fullsubmit” using the Makefile we provide)If you are working with a partner,both partners must submit to the autograder

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 8 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Winter
Professor
Jag
Tags
Graph Theory, Depth first search

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture