-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexList.h
More file actions
31 lines (25 loc) · 1.07 KB
/
ComplexList.h
File metadata and controls
31 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*******************************************************************
Copyright(c) 2016, Harry He
All rights reserved.
Distributed under the BSD license.
(See accompanying file LICENSE.txt at
https://github.com/zhedahht/CodingInterviewChinese2/blob/master/LICENSE.txt)
*******************************************************************/
//==================================================================
// 《剑指Offer——名企面试官精讲典型编程题》代码
// 作者:何海涛
//==================================================================
// 面试题35:复杂链表的复制
// 题目:请实现函数ComplexListNode* Clone(ComplexListNode* pHead),复
// 制一个复杂链表。在复杂链表中,每个结点除了有一个m_pNext指针指向下一个
// 结点外,还有一个m_pSibling 指向链表中的任意结点或者nullptr。
#pragma once
struct ComplexListNode
{
int m_nValue;
ComplexListNode* m_pNext;
ComplexListNode* m_pSibling;
};
ComplexListNode* CreateNode(int nValue);
void BuildNodes(ComplexListNode* pNode, ComplexListNode* pNext, ComplexListNode* pSibling);
void PrintList(ComplexListNode* pHead);