简体   繁体   English

Java-使用树数据结构的矩阵实现

[英]Java - matrix implementation using a tree data structure

Is there any method to implement a matrix using a tree data structure? 是否有使用树数据结构实现矩阵的方法? I have thought about it. 我已经考虑过了 You could implement an array using a tree data structure but in case of the matrices, how can you also keep track of the number of rows and columns? 您可以使用树数据结构实现数组,但是在矩阵的情况下,如何跟踪行和列的数量? Any ideas? 有任何想法吗?

For a square matrix 2^nx 2^n you could represent it by a quadtree (each node has pointers to NW, NE, SE, SW subtrees). 对于方阵2^nx 2^n ,可以用四叉树表示(每个节点都有指向NW,NE,SE,SW子树的指针)。 You could represent other sizes of matrix (even rectangular) if some of the pointers to subtrees are null. 如果某些指向子树的指针为空,则可以表示其他大小的矩阵(甚至矩形)。 Null pointers mean that a sub-square of the matrix is empty. 空指针表示矩阵的子正方形为空。 I'm not sure what use such a data structure would be ... maybe in image processing? 我不确定这种数据结构的用途是……也许在图像处理中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM