摘要:
1)递归 int GetHeight(link root) { if(NULL== root) return false; int left_count = GetHeight(root->ls)+1; int right_count = GetHeight(root->rs)+1; return left_count > right_count ... 阅读全文
摘要:
/* 判断单链表是否存在环 1)暴力:双层循环遍历(n^2) 2)双指针:快指针fast=NULL,慢指针slow=NULL int judge(link head) { if(NULL==head) return false; link fast = head, slow = head; while(slow!=NULL && fast!=NULL) { slow = slow->next; f 阅读全文