二叉树模型代码

package test;


public class tree2 {
private int data;
private tree2 lChild;
private tree2 rChild;

public int getNodes(){
return (this.lChild == null ? 0 :
this.lChild.getNodes( ) )
+ ( this.rChild == null
? 0 : this.rChild.getNodes( ) ) + 1;
}
public int sum(){
return ( this.lChild == null ? 0 :
this.lChild.sum( ) )
+ ( this.rChild == null ? 0 :
this.rChild.sum( ) ) + this.data;
}

public void fTraverse( ) {
System.out.print( this.data+" " );
if( this.lChild != null ) {
this.lChild.fTraverse( );
}
if( this.rChild != null ) {
this.rChild.fTraverse( );
}
}
public void mTraverse( ) {
if( this.lChild != null ) {
this.lChild.mTraverse( );
}
System.out.print( this.data+" " );
if( this.rChild != null ) {
this.rChild.mTraverse( );
}
}
public void lTraverse( ) {
if( this.lChild != null ) {
this.lChild.lTraverse( );
}
if( this.rChild != null ) {
this.rChild.lTraverse( );
}
System.out.print( this.data+" " );
}

public void addNode(tree2 node ) {
if ( node.data< this.data ) {
if ( this.lChild == null ) {
this.lChild = node;
} else {
this.lChild.addNode( node );
}
}else if(node.data> this.data){
if ( this.rChild == null ) {
this.rChild = node;
} else {
this.rChild.addNode( node );
}
}

}
public tree2(int data) {
this.data = data;
}

public int getData() {
return data;
}

public void setData(int data) {
this.data = data;
}

public tree2 getlChild() {
return lChild;
}

public void setlChild(tree2 lChild) {
this.lChild = lChild;
}

public tree2 getrChild() {
return rChild;
}

public void setrChild(tree2 rChild) {
this.rChild = rChild;
}
}

  

转载于:https://www.cnblogs.com/qinyios/p/10971422.html

文章作者写的matlab源代码,该文章发表在Digital Signal Processing: Ke-Kun Huang , Hui Liu, Chuan-Xian Ren, Yu-Feng Yu and Zhao-Rong Lai. Remote sensing image compression based on binary tree and optimized truncation. Digital Signal Processing, vol. 64, pp. 96-106, 2017. (http://dx.doi.org/10.1016/j.dsp.2017.02.008) 遥感图像数据非常广泛,因此需要通过空间设备上的低复杂度算法进行压缩。具有自适应扫描顺序(BTCA)的二叉树编码是一个的有效算法。然而,对于大规模遥感图像,BTCA需要大量的内存,而且不能随机存取。在本文中,我们提出了一种基于BTCA的新的编码方法。小波图像首先划分为几个块,并由BTCA单独编码的。根据BTCA的属性,仔细选择每个块的有效截断点,以优化速率失真的比例,从而获得更高的压缩比、更低的内存要求和随机访问性能。由于没有任何熵编码,所提出的方法简单快速,非常适合于空间设备。对三个遥感图像集进行实验,结果表明它可以显着提高PSNR、SSIM和VIF,以及主观视觉体验。 The remote sensing image data is so vast that it requires compression by low-complexity algorithm on space-borne equipment. Binary tree coding with adaptive scanning order (BTCA) is an effective algorithm for the mission. However, for large-scale remote sensing images, BTCA requires a lot of memory, and does not provide random access property. In this paper, we propose a new coding method based on BTCA and optimize truncation. The wavelet image is first divided into several blocks which are encoded individually by BTCA. According the property of BTCA, we select the valid truncation points for each block carefully to optimize the ratio of rate-distortion, so that a higher compression ratio, lower memory requirement and random access property are attained. Without any entropy coding, the proposed method is simple and fast, which is very suitable for space-borne equipment. Experiments are conducted on three remote sensing image sets, and the results show that it can significantly improve PSNR, SSIM and VIF, as well as subjective visual experience.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值