Question: Solve the following data structure question in C language? 1. Consider a two-dimensional .txt matrix file that does not contain negative numbers 0-255. Our aim

Solve the following data structure question in C language?

1. Consider a two-dimensional .txt matrix file that does not contain negative numbers 0-255.

Solve the following data structure question in C language? 1. Consider a

Our aim is to group similar numbers among the numbers given in this matrix and finally collect the groups and the matrix elements of these groups together.
 2- Neighboring numbers should be taken into account when grouping. In other words, numbers to the right, left, above and below a number can be adjacent to each other.

3- The edge weight between any two adjacent numbers is the absolute value of the difference between the two numbers.

4- Assume that at the beginning each number is only in its group, G. So let there be m x n groups.

So as we mentioned:

numbers = nodes

side weights, lengths of graphs = difference between numbers

5- There are as many nodes as there are numbers in the matrix file.

6- The Minimum Spanning Tree algorithm will be calculated for each group as needed.

7- The difference between the two nodes is the smallest edge that connects these two nodes.

8- If two nodes are not connected to each other, that is, they do not have any edges, the difference in the number of nodes is either infinite or greater than the largest edge connecting the nodes.

9- The two groups G1 and G2 are separate (not to be combined) if the difference between; If Difference(G1,G2) > Minimum Internal Difference(G1,G2), these two groups should be combined.

G ----> represents node, G1,G2, ..... represents groups. |G| -------> is the number of elements of the group formed by the joining nodes. T(G) = 300/ |G| minimum internal difference (G1, G2) = minimum ( internal difference (G1) + T(G1), internal difference ( G2 + T(G2) )

10- At the end of the problem, we output the grouped structures as a one-dimensional array.

In short, we group the 2-dimensional m x n matrix and print it on the screen as a one-dimensional array.

252 254 254 254 252 250 248 246 245 240 237 249 249 250 250 249 249 247 246 242 240 235 245 243 244 245 245 245 243 242 241 239 234 238 237 238 238 239 239 239 237 237 234 230 230 230 231 231 232 233 232 231 231 230 228 223 224 224 225 226 226 227 226 226 224 222 213 214 215 217 218 220 221 221 221 220 216 202 204 206 208 211 214 217 218 218 217 212 195 196 198 201 206 211 215 218 218 215 210

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!