4=6=8=10=12=14=16
struct BSTreeNode
{
int m_nValue; // value of node
BSTreeNode *m_pLeft; // left child of node
BSTreeNode *m_pRight; // right child of node
};
void convertToDoubleList(BSTreeNode* pCurrent)
{
pCurrent->m_pLeft=pIndex;
if (pIndex == NULL)
{
pHead=pCurrent;
}
else
{
pIndex->m_pRight=pCurrent;
}
pIndex=pCurrent;
}
typedef struct node
{
int data;
struct node * next;
}List;
int isJoinedNocylic(List * h1,List * h2)
{
while(h1 != NULL)
h1 = h1->next;
while(h2 != NULL)
h2 = h2->next;
return h1 == h2;
}
int isCycle(List * h)
{
List * p1, * p2;
p1 = p2 = h;
int flag;
while(p2 != NULL && p2->next != NULL)
{
p1 = p1->next;
p2 = p2->next->next;
if(p1 == p2)
{
flag = 1;
break;
}
}
flag = 0;
return flag;
}
2s = s + nr s= nr
a + x = nr a + x = (n – 1)r +r = (n-1)r + L - a a = (n-1)r + (L – a – x)
List * isJoined(List * h1,List * h2)
{
List * ph1,*p1,*p2;
int flag;
ph1 = h1;
while(ph1->next != NULL)
ph1 = ph1->next;
ph1->next = h2;
if(0 == isCycle(h1))
{
flag = 0;
}
else
{
p1 = h1;
while(p1 != p2)
{
p1 = p1->next;
p2 = p2->next;
}
flag = p1;
}
return flag;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有