{"id":90212,"date":"2025-09-08T06:41:59","date_gmt":"2025-09-08T06:41:59","guid":{"rendered":"https:\/\/essays.homeworkacetutors.com\/design-algorithms-java\/"},"modified":"2025-09-08T06:41:59","modified_gmt":"2025-09-08T06:41:59","slug":"design-algorithms-java","status":"publish","type":"post","link":"https:\/\/www.colapapers.com\/us\/design-algorithms-java\/","title":{"rendered":"Design algorithms ( Java)"},"content":{"rendered":"<p>Question description<\/p>\n<p>Problem 1Please refer the document below\u00a0A binary digital image a rectangular grid of black and white pixels. The image shown in Figure 1 consistsof 17*9 pixels.Diagram is belowIn this assignment, you write a program to count the connected blocks in a binary digital image. For example:There are three connected blocks in Figure 2a, six connected blocks in Figure 2b, 14 connected blocks inFigure 2c, and one connected block in Figure 2d. If we count white blocks, there are two connected blocksin Figure 1.Create a NetBeans java project, add the jar file \u201cstdlib-package.jar\u201d. The \u201cPicture\u201d class in this packagecan read and show digital image files. You can also get the height, width of the image, and the color of eachpixel on the image. The following code opens a image file, displays it, returns the height and width of theimage, and the color of a pixel at grid position x,y.Picture pic = new Picture(fileName);pic.show();height = pic.height();width = pic.width();5 Color t = pic.get(x, y);In order to find a connected block, you find a black pixel, then you recursively visit all neighbors of the pixelto check if any neighbor is a black pixel too. Then you move to the neighbor, and repeat until no more\u201cblack pixel\u201d neighbors. As shown in Figure 3, there are 8 neighbors a pixel.You can use this skeleton code. Function \u201cCountConnectedBlocks\u201d receives a file name and returns thenumber of connected black-colored blocks.import edu.princeton.cs.introcs.Picture;import java.awt.Color;public class ImageBlocks {stat i c Color BLACK = new Color(0,0,0);5 stat i c Color WHITE = new Color(255,255,255);private int height;private int width;int [ ][ ] visited;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question description Problem 1Please refer the document below\u00a0A binary digital image a rectangular grid of black and white pixels. The image shown in Figure 1 consistsof 17*9 pixels.Diagram is belowIn this assignment, you write a program to count the connected blocks in a binary digital image. For example:There are three connected blocks in Figure 2a, [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11588,9844,10754,11589,9797,10756,3352,10755],"tags":[9832,9873,10767,3722,10520,10766,9799,11206,11347,9831,9817,10765],"class_list":["post-90212","post","type-post","status-publish","format-standard","hentry","category-complete-the-assignment-in-a-page-paper","category-edu-essay-help-for-students","category-i-need-help-with-my-essay","category-i-need-my-essay-completed-in-300-400-words","category-professor-essays","category-research-papers-acemyhomework","category-us","category-10755","tag-ae","tag-ca","tag-dissertation-study-bay","tag-get-assignments-done","tag-global-assignment-help","tag-help-with-my-assignment","tag-research-essay-pro","tag-students-assignment-help","tag-superior-essay-papers","tag-usa-assignment-answers-examples","tag-written-essay-hub","tag-10765"],"_links":{"self":[{"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/posts\/90212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/comments?post=90212"}],"version-history":[{"count":0,"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/posts\/90212\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/media?parent=90212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/categories?post=90212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.colapapers.com\/us\/wp-json\/wp\/v2\/tags?post=90212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}