Пример #1
0
int main()

{
    nodeT *t=createTreeRoot();
    nodeL *l=createListFromTree(t);
    free(t);
    l=s->first;
    LIST(l);// prints the list
    printf("\n");
    t=createTreeFromList(l);
    TREE(t,0);//the tree
    return 0;
}
Пример #2
0
// --------------------------------------------------------------------------------
// -------------------- RDODPTSearch
// --------------------------------------------------------------------------------
RDODPTSearch::RDODPTSearch(CREF(LPRDORuntime) pRuntime, LPIBaseOperationContainer pParent)
	: RDOLogicSimple(pRuntime, pParent)
	, treeRoot      (NULL)
{}

RDODPTSearch::~RDODPTSearch()
{}

IBaseOperation::BOResult RDODPTSearch::onDoOperation(CREF(LPRDORuntime) pRuntime)
{
	// Начало поиска: вывели трасировку, обновили статистику
	onSearchBegin(pRuntime);
	treeRoot = createTreeRoot(pRuntime);
	treeRoot->createRootTreeNode(pRuntime->clone());

	return onContinue(pRuntime);
}

IBaseOperation::BOResult RDODPTSearch::onContinue(CREF(LPRDORuntime) pRuntime)
{
	UNUSED(pRuntime);
	ruint32 time_begin = ::GetTickCount();
	for (;;)
	{
		// Возмем для раскрытия первую вершину из списка OPEN
		TreeNode* curr = *(treeRoot->m_OPEN.begin());
		curr->ExpandChildren();
		if (treeRoot->m_OPEN.empty() || treeRoot->m_targetNode) break;