int Depth ( GList ls ) { if ( !ls ) return 1; /*空表深度为1*/ if ( ls->tag = = 0 ) return 0; /*单元素深度为0*/ for ( max = 0,p = ls; p; p = p->ptr.tp ) { dep = Depth ( p->ptr.hp ); /*求以p->ptr.hp 尾头指针的子表深度*/ if ( dep > max ) max = dep; } return max+1; /*非空表的深度是各元素的深度的最大值加1*/ }