|
|
|
@ -2297,54 +2297,56 @@
|
|
|
|
|
<a id="__codelineno-11-83" name="__codelineno-11-83" href="#__codelineno-11-83"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">fNext</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-84" name="__codelineno-11-84" href="#__codelineno-11-84"></a><span class="w"> </span><span class="n">fNext</span><span class="o">-></span><span class="n">prev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-85" name="__codelineno-11-85" href="#__codelineno-11-85"></a><span class="w"> </span><span class="n">front</span><span class="o">-></span><span class="n">next</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-86" name="__codelineno-11-86" href="#__codelineno-11-86"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-87" name="__codelineno-11-87" href="#__codelineno-11-87"></a><span class="w"> </span><span class="n">front</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">fNext</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新头结点</span>
|
|
|
|
|
<a id="__codelineno-11-88" name="__codelineno-11-88" href="#__codelineno-11-88"></a><span class="w"> </span><span class="c1">// 队尾出队操作</span>
|
|
|
|
|
<a id="__codelineno-11-89" name="__codelineno-11-89" href="#__codelineno-11-89"></a><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-90" name="__codelineno-11-90" href="#__codelineno-11-90"></a><span class="w"> </span><span class="n">val</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">val</span><span class="p">;</span><span class="w"> </span><span class="c1">// 暂存尾结点值</span>
|
|
|
|
|
<a id="__codelineno-11-91" name="__codelineno-11-91" href="#__codelineno-11-91"></a><span class="w"> </span><span class="c1">// 删除尾结点</span>
|
|
|
|
|
<a id="__codelineno-11-92" name="__codelineno-11-92" href="#__codelineno-11-92"></a><span class="w"> </span><span class="n">DoublyListNode</span><span class="w"> </span><span class="o">*</span><span class="n">rPrev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">prev</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-93" name="__codelineno-11-93" href="#__codelineno-11-93"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">rPrev</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-94" name="__codelineno-11-94" href="#__codelineno-11-94"></a><span class="w"> </span><span class="n">rPrev</span><span class="o">-></span><span class="n">next</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-95" name="__codelineno-11-95" href="#__codelineno-11-95"></a><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">prev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-96" name="__codelineno-11-96" href="#__codelineno-11-96"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-97" name="__codelineno-11-97" href="#__codelineno-11-97"></a><span class="w"> </span><span class="n">rear</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rPrev</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新尾结点</span>
|
|
|
|
|
<a id="__codelineno-11-86" name="__codelineno-11-86" href="#__codelineno-11-86"></a><span class="w"> </span><span class="k">delete</span><span class="w"> </span><span class="n">front</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-87" name="__codelineno-11-87" href="#__codelineno-11-87"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-88" name="__codelineno-11-88" href="#__codelineno-11-88"></a><span class="w"> </span><span class="n">front</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">fNext</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新头结点</span>
|
|
|
|
|
<a id="__codelineno-11-89" name="__codelineno-11-89" href="#__codelineno-11-89"></a><span class="w"> </span><span class="c1">// 队尾出队操作</span>
|
|
|
|
|
<a id="__codelineno-11-90" name="__codelineno-11-90" href="#__codelineno-11-90"></a><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-91" name="__codelineno-11-91" href="#__codelineno-11-91"></a><span class="w"> </span><span class="n">val</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">val</span><span class="p">;</span><span class="w"> </span><span class="c1">// 暂存尾结点值</span>
|
|
|
|
|
<a id="__codelineno-11-92" name="__codelineno-11-92" href="#__codelineno-11-92"></a><span class="w"> </span><span class="c1">// 删除尾结点</span>
|
|
|
|
|
<a id="__codelineno-11-93" name="__codelineno-11-93" href="#__codelineno-11-93"></a><span class="w"> </span><span class="n">DoublyListNode</span><span class="w"> </span><span class="o">*</span><span class="n">rPrev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">prev</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-94" name="__codelineno-11-94" href="#__codelineno-11-94"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">rPrev</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-95" name="__codelineno-11-95" href="#__codelineno-11-95"></a><span class="w"> </span><span class="n">rPrev</span><span class="o">-></span><span class="n">next</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-96" name="__codelineno-11-96" href="#__codelineno-11-96"></a><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">prev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">nullptr</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-97" name="__codelineno-11-97" href="#__codelineno-11-97"></a><span class="w"> </span><span class="k">delete</span><span class="w"> </span><span class="n">rear</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-98" name="__codelineno-11-98" href="#__codelineno-11-98"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-99" name="__codelineno-11-99" href="#__codelineno-11-99"></a><span class="w"> </span><span class="n">queSize</span><span class="o">--</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新队列长度</span>
|
|
|
|
|
<a id="__codelineno-11-100" name="__codelineno-11-100" href="#__codelineno-11-100"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-101" name="__codelineno-11-101" href="#__codelineno-11-101"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-102" name="__codelineno-11-102" href="#__codelineno-11-102"></a>
|
|
|
|
|
<a id="__codelineno-11-103" name="__codelineno-11-103" href="#__codelineno-11-103"></a><span class="w"> </span><span class="cm">/* 队首出队 */</span>
|
|
|
|
|
<a id="__codelineno-11-104" name="__codelineno-11-104" href="#__codelineno-11-104"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">popFirst</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-105" name="__codelineno-11-105" href="#__codelineno-11-105"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">pop</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
|
|
|
|
|
<a id="__codelineno-11-106" name="__codelineno-11-106" href="#__codelineno-11-106"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-107" name="__codelineno-11-107" href="#__codelineno-11-107"></a>
|
|
|
|
|
<a id="__codelineno-11-108" name="__codelineno-11-108" href="#__codelineno-11-108"></a><span class="w"> </span><span class="cm">/* 队尾出队 */</span>
|
|
|
|
|
<a id="__codelineno-11-109" name="__codelineno-11-109" href="#__codelineno-11-109"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">popLast</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-110" name="__codelineno-11-110" href="#__codelineno-11-110"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">pop</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
|
|
|
|
|
<a id="__codelineno-11-111" name="__codelineno-11-111" href="#__codelineno-11-111"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-112" name="__codelineno-11-112" href="#__codelineno-11-112"></a>
|
|
|
|
|
<a id="__codelineno-11-113" name="__codelineno-11-113" href="#__codelineno-11-113"></a><span class="w"> </span><span class="cm">/* 访问队首元素 */</span>
|
|
|
|
|
<a id="__codelineno-11-114" name="__codelineno-11-114" href="#__codelineno-11-114"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">peekFirst</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-115" name="__codelineno-11-115" href="#__codelineno-11-115"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">isEmpty</span><span class="p">()</span><span class="w"> </span><span class="o">?</span><span class="w"> </span><span class="mi">-1</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">front</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-116" name="__codelineno-11-116" href="#__codelineno-11-116"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-117" name="__codelineno-11-117" href="#__codelineno-11-117"></a>
|
|
|
|
|
<a id="__codelineno-11-118" name="__codelineno-11-118" href="#__codelineno-11-118"></a><span class="w"> </span><span class="cm">/* 访问队尾元素 */</span>
|
|
|
|
|
<a id="__codelineno-11-119" name="__codelineno-11-119" href="#__codelineno-11-119"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">peekLast</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-120" name="__codelineno-11-120" href="#__codelineno-11-120"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">isEmpty</span><span class="p">()</span><span class="w"> </span><span class="o">?</span><span class="w"> </span><span class="mi">-1</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-121" name="__codelineno-11-121" href="#__codelineno-11-121"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-122" name="__codelineno-11-122" href="#__codelineno-11-122"></a>
|
|
|
|
|
<a id="__codelineno-11-123" name="__codelineno-11-123" href="#__codelineno-11-123"></a><span class="w"> </span><span class="cm">/* 返回数组用于打印 */</span>
|
|
|
|
|
<a id="__codelineno-11-124" name="__codelineno-11-124" href="#__codelineno-11-124"></a><span class="w"> </span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="w"> </span><span class="n">toVector</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-125" name="__codelineno-11-125" href="#__codelineno-11-125"></a><span class="w"> </span><span class="n">DoublyListNode</span><span class="w"> </span><span class="o">*</span><span class="n">node</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">front</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-126" name="__codelineno-11-126" href="#__codelineno-11-126"></a><span class="w"> </span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="w"> </span><span class="n">res</span><span class="p">(</span><span class="n">size</span><span class="p">());</span>
|
|
|
|
|
<a id="__codelineno-11-127" name="__codelineno-11-127" href="#__codelineno-11-127"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">res</span><span class="p">.</span><span class="n">size</span><span class="p">();</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-128" name="__codelineno-11-128" href="#__codelineno-11-128"></a><span class="w"> </span><span class="n">res</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">node</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-129" name="__codelineno-11-129" href="#__codelineno-11-129"></a><span class="w"> </span><span class="n">node</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">node</span><span class="o">-></span><span class="n">next</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-130" name="__codelineno-11-130" href="#__codelineno-11-130"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-131" name="__codelineno-11-131" href="#__codelineno-11-131"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">res</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-99" name="__codelineno-11-99" href="#__codelineno-11-99"></a><span class="w"> </span><span class="n">rear</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rPrev</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新尾结点</span>
|
|
|
|
|
<a id="__codelineno-11-100" name="__codelineno-11-100" href="#__codelineno-11-100"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-101" name="__codelineno-11-101" href="#__codelineno-11-101"></a><span class="w"> </span><span class="n">queSize</span><span class="o">--</span><span class="p">;</span><span class="w"> </span><span class="c1">// 更新队列长度</span>
|
|
|
|
|
<a id="__codelineno-11-102" name="__codelineno-11-102" href="#__codelineno-11-102"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-103" name="__codelineno-11-103" href="#__codelineno-11-103"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-104" name="__codelineno-11-104" href="#__codelineno-11-104"></a>
|
|
|
|
|
<a id="__codelineno-11-105" name="__codelineno-11-105" href="#__codelineno-11-105"></a><span class="w"> </span><span class="cm">/* 队首出队 */</span>
|
|
|
|
|
<a id="__codelineno-11-106" name="__codelineno-11-106" href="#__codelineno-11-106"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">popFirst</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-107" name="__codelineno-11-107" href="#__codelineno-11-107"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">pop</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
|
|
|
|
|
<a id="__codelineno-11-108" name="__codelineno-11-108" href="#__codelineno-11-108"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-109" name="__codelineno-11-109" href="#__codelineno-11-109"></a>
|
|
|
|
|
<a id="__codelineno-11-110" name="__codelineno-11-110" href="#__codelineno-11-110"></a><span class="w"> </span><span class="cm">/* 队尾出队 */</span>
|
|
|
|
|
<a id="__codelineno-11-111" name="__codelineno-11-111" href="#__codelineno-11-111"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">popLast</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-112" name="__codelineno-11-112" href="#__codelineno-11-112"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">pop</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
|
|
|
|
|
<a id="__codelineno-11-113" name="__codelineno-11-113" href="#__codelineno-11-113"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-114" name="__codelineno-11-114" href="#__codelineno-11-114"></a>
|
|
|
|
|
<a id="__codelineno-11-115" name="__codelineno-11-115" href="#__codelineno-11-115"></a><span class="w"> </span><span class="cm">/* 访问队首元素 */</span>
|
|
|
|
|
<a id="__codelineno-11-116" name="__codelineno-11-116" href="#__codelineno-11-116"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">peekFirst</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-117" name="__codelineno-11-117" href="#__codelineno-11-117"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">isEmpty</span><span class="p">()</span><span class="w"> </span><span class="o">?</span><span class="w"> </span><span class="mi">-1</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">front</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-118" name="__codelineno-11-118" href="#__codelineno-11-118"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-119" name="__codelineno-11-119" href="#__codelineno-11-119"></a>
|
|
|
|
|
<a id="__codelineno-11-120" name="__codelineno-11-120" href="#__codelineno-11-120"></a><span class="w"> </span><span class="cm">/* 访问队尾元素 */</span>
|
|
|
|
|
<a id="__codelineno-11-121" name="__codelineno-11-121" href="#__codelineno-11-121"></a><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">peekLast</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-122" name="__codelineno-11-122" href="#__codelineno-11-122"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">isEmpty</span><span class="p">()</span><span class="w"> </span><span class="o">?</span><span class="w"> </span><span class="mi">-1</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">rear</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-123" name="__codelineno-11-123" href="#__codelineno-11-123"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-124" name="__codelineno-11-124" href="#__codelineno-11-124"></a>
|
|
|
|
|
<a id="__codelineno-11-125" name="__codelineno-11-125" href="#__codelineno-11-125"></a><span class="w"> </span><span class="cm">/* 返回数组用于打印 */</span>
|
|
|
|
|
<a id="__codelineno-11-126" name="__codelineno-11-126" href="#__codelineno-11-126"></a><span class="w"> </span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="w"> </span><span class="n">toVector</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-127" name="__codelineno-11-127" href="#__codelineno-11-127"></a><span class="w"> </span><span class="n">DoublyListNode</span><span class="w"> </span><span class="o">*</span><span class="n">node</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">front</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-128" name="__codelineno-11-128" href="#__codelineno-11-128"></a><span class="w"> </span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="w"> </span><span class="n">res</span><span class="p">(</span><span class="n">size</span><span class="p">());</span>
|
|
|
|
|
<a id="__codelineno-11-129" name="__codelineno-11-129" href="#__codelineno-11-129"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">res</span><span class="p">.</span><span class="n">size</span><span class="p">();</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
|
|
|
|
|
<a id="__codelineno-11-130" name="__codelineno-11-130" href="#__codelineno-11-130"></a><span class="w"> </span><span class="n">res</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">node</span><span class="o">-></span><span class="n">val</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-131" name="__codelineno-11-131" href="#__codelineno-11-131"></a><span class="w"> </span><span class="n">node</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">node</span><span class="o">-></span><span class="n">next</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-132" name="__codelineno-11-132" href="#__codelineno-11-132"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-133" name="__codelineno-11-133" href="#__codelineno-11-133"></a><span class="p">};</span>
|
|
|
|
|
<a id="__codelineno-11-133" name="__codelineno-11-133" href="#__codelineno-11-133"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">res</span><span class="p">;</span>
|
|
|
|
|
<a id="__codelineno-11-134" name="__codelineno-11-134" href="#__codelineno-11-134"></a><span class="w"> </span><span class="p">}</span>
|
|
|
|
|
<a id="__codelineno-11-135" name="__codelineno-11-135" href="#__codelineno-11-135"></a><span class="p">};</span>
|
|
|
|
|
</code></pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tabbed-block">
|
|
|
|
|