日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

链表面试笔试题目总结

發布時間:2023/12/10 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 链表面试笔试题目总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

鏈表是最基本的數據結構,凡是學計算機的必須的掌握的,在面試的時候經常被問到,關于鏈表的實現,百度一下就知道了。在此可以討論一下與鏈表相關的練習題。


1在單鏈表上插入一個元素,要求時間復雜度為O(1)

解答:一般情況在鏈表中插入一元素是在末尾插入的,這樣需要從頭遍歷一次鏈表,找到末尾,時間為O(n)。要在O(1)時間插入一個新節點,可以考慮每次在頭節點后面插入,即每次插入的節點成為鏈表的第一個節點。


2、給定一個鏈表,判斷是否有環。

解答:這個是一個經典的問題了,思路也很簡單,我們首先設置兩個指針p1,p2同時指向鏈表的頭部,然后p1每次向后走1步,p2每次向后走2步。如果有環,那么有一步會出現p1=p2,如果p2已經到達了尾結點,則無環。復雜度:時間:O(n),空間:O(1)

擴展:給定一個鏈表,找出環的入口位置。思路也是一樣,用p1,p2指針。只是需要多做一步,那就是當p1=p2的時候,將p1重新指向鏈表的頭結點,然后p1和p2都每次向后走一步,下一次p1=p2的結點就是環的入口。復雜度:時間:O(n),空間:O(1)


3、遍歷單鏈表一次,找出鏈表中間節點

解答:定義兩個指針p和q,初始都指向鏈表頭節點。然后開始向后遍歷,p每次移動2步,q移動一步,當p到達末尾的時候,p正好到達了中間位置。


4、單鏈表逆置,不允許額外分配存儲空間,不允許遞歸,可以使用臨時變量,執行時間為O(n)

解答:這個題目在面試筆試中經常碰到,基本思想上將指針逆置。如下圖所示:


實現:

Node* reverse_list(Node *head){Node *cur=head;Node *pre = NULL;Node *post = cur->next; <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// Node *reverse_head = cur;</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(post){cur->next = pre;pre = cur;cur = post;post = post->next;}cur->next = pre; <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// reverse_head = cur;</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> cur; }


擴展:鏈表翻轉。給出一個鏈表和一個數k,比如,鏈表為1→2→3→4→5→6k=2,則翻轉后2→1→6→5→4→3,若k=3,翻轉后3→2→1→6→5→4,若k=4,翻轉后4→3→2→1→6→5,用程序實現。

實質是也是逆置,只不過是兩個鏈表逆置后再串聯起來。實現如下:

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">bool</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">rotate_list</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node *head,<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> k,Node* &newhead)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(k < <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">if</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(0 == k)</span>return <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span></span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> len = <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>;Node *node=head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(node){++len;node = node->next;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(k > len)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;Node *one_end,*two_start;node = head;Node *post = node->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> n=k;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span> == n){}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(n > <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>){<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// rotate sublist one</span>node->next = post->next;post->next = head;head = post;post = node->next;--n;}}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(len-k <= <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>){ <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// rotate sublist two</span>}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{one_end = node;node = post;post = post->next;two_start = node;n = len-k;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(n><span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>){one_end->next = post;node->next = post->next;post->next = two_start;two_start = post;post = node->next;--n;}}newhead = head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>; }

5、用一個單鏈表L實現一個棧,要求pushpop的操作時間為O(1)

解答:根據棧中元素先進后出的特點,可以在鏈表的頭部進行插入和刪除操作


6、用一個單鏈表L實現一個隊列,要求enqueuedequeue的操作時間為O(1)

解答:隊列中的元素是先進先出,在單鏈表結構中增加一個尾指針,數據從尾部入隊,從頭

部入隊。


7、給定兩個鏈表(無環),判斷是否有相交。

解答:首先明確一點,如果兩個鏈表相交,那么從第一個交點開始到尾結點結束,所有的結點都是公共結點。所以,兩個有公共結點而部分重合的鏈表,拓撲形狀看起來像一個Y,而不可能像X。

這也就是說,如果兩個鏈表相交,那么這兩個鏈表的尾結點肯定是公共結點,如果尾結點不是公共結點,那么這兩個鏈表肯定不相交。

所以我們可以如下操作:依次遍歷兩個鏈表,最后判斷尾結點是否相同,如果相同,則相交,如果不相同,則不相交。復雜度:時間:O(m+n),空間:O(1)

或者一個鏈表的頭結點指向另一個鏈表的尾節點,判斷是否有環。


8、給定兩個鏈表(無環),找到第一個公共節點。

解答:我們最容易想到的是從尾結點開始挨個向前比較,最后一個相同的就是第一個公共結點。(從后往前遍歷)

但是單鏈表只能從前往后進行遍歷,如果想要從后往前的話則需要先從前向后遍歷一次,同時用來記錄每一個結點,最后出棧,然后挨個對比,這樣的確可行,但是卻要額外付出O(m+n)的空間,時間復雜度O(mn)。(單鏈表+棧)

仔細想想,我們可以先分別遍歷兩個單鏈表,記錄長度m和n(無妨假設m>n),然后先讓長度為m的鏈表向后走(m-n)步,接著兩個鏈表同時向后遍歷,第一個相同的結點就是要求的第一個公共結點。復雜度:O(m+n)m,n分別為兩個鏈表的長度;空間:O(1)

PS:另外還有一種巧妙的方法是把在一個鏈表尾部插入另一個鏈表,然后判斷合成的新鏈表是否有環。環入口即為第一個公共點。

可參考:http://www.voidcn.com/blog/wcyoot/article/p-2762597.html


擴展:兩個鏈表,找出他們的第一個交點,要求每個鏈表只能遍歷一次,可以對鏈表進行任何操作,空間O(1).

題目告訴說可以對鏈表進行任何操作,這是一個沒有用到的條件(大家一定要注意到題目中沒有用到的條件,往往是解題的關鍵所在)。

1.遍歷第一個鏈表List1,將每一個節點的next都置為NULL。

2.遍歷第二個鏈表List2,List2的尾節點就是第一個交點。

?

9、?給定2個鏈表,求這2個鏈表的并集(鏈表)和交集(鏈表)。不要求并集(鏈表)和交集(鏈表)中的元素有序。輸入:List1:10->15->4->20List2:8->4->2->10輸出:交集(鏈表)4->10并集(鏈表)2->8->20->4->15->10

法一:簡單直觀的方法:

InterSection(list1,list2):初始化結果鏈表為空,遍歷鏈表1,在鏈表2中查找它的每一元素,如果鏈表2中也有這個元素,則將該元素插入到結果鏈表中。

? ? ?Union(list1,list2): 初始化結果鏈表為空,將鏈表1中的所有元素都插入到結果鏈表中。遍歷鏈表2,如果結果鏈表中沒有該元素,則插入,否則跳過該元素。

法二:可適應歸并排序,not clear。

法三:Hash法

Union(list1,list2),首先用鏈表1初始化結果鏈表,創建一個空的hash表。遍歷鏈表1,將鏈表中的元素插入到hash表。然后遍歷list2,對于list2中的元素,如果hash表中不存在該元素,則同時將該元素插入到結果鏈表中,如果hash表中已經存在,則忽略該元素,繼續遍歷下一個元素。

InterSection(list1,list2),首先初始化結果鏈表為NULL,創建一個空的hash表。遍歷list1,將list1中的每一個元素都插入到hash表中。然后遍歷list2,對于list2中的元素,如果已經存在于hash表中,則將該元素插入到結果鏈表,如果不存在與hash表中,則忽略該元素,繼續遍歷下一個元素。

參考:http://blog.csdn.net/lalor/article/details/7430631


10、從單鏈表返回倒數第n個元素

普通,基本思路就是用棧,一一壓棧,再彈棧,第n個元素就可出來。

進階,看到棧,就應該想到遞歸,遞歸是天然的棧。用全局變量,實現如下:

Node* pn_elem = NULL; <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> nn; <span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">recursive</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node* node)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!node) <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> ;recursive(node->next);<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>==nn) pn_elem = node;--nn; }

高級,維護兩個指針,兩個指針相差n個元素,當前面的指針到達鏈表末尾,后面指針所指的元素即是所求的元素。實現如下

Node* last_n_elem(Node*node,<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> n){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(node! || n<<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>) returnNULL;Node *p=node,*q=node;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(n><span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span> && q){q=q->next;--n;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(q){q=q->next;p=p->next;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> p; }

11、鏈表元素去重,從未排序的鏈表中移除重復的項。

思路:可使用額外的空間的話,可以用數組存數字,實現最好的方式就是哈希表啦。遍歷一下即可。

實現:

std::<span class="hljs-stl_container" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">map</span><Node*, <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">bool</span>></span>hash; <span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">duplicate_remove</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node *node)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!node) <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> ;Node *post=node->next;hash[node->data] = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(post){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(hash[post->data]){Node *temp = post;post = post->next;node->next = post;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">delete</span> temp;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{hash[post->data] = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>;node = post;post = post->next;}} }

如果不允許使用臨時緩存,怎么解決?

思路:用兩個指針。當某個指針指向某個元素時,另一個指針將后面的相同元素全部刪除。復雜度O(n^2)。具體實現就不寫了。


12鏈表求和問題。

該問題基本上有兩個類型:

a、1->2->5->4 , 2->5->3->4,得3->7->8->8.

思路:先加高位,再加低位。兩個0~9的數相加,要么不進位,要么進位為1.用兩個指針,p指向當前進位點,q指向當前操作點。當然第一個元素得特殊考慮,可能進位嘛。

自己實現:

Node* merge_list_add(Node *list1,Node *list2){Node*q1=list1,*q2=list2,*ans=NULL,*pre=NULL,*p=NULL,*q=NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> cvalue = q1->data+ q2->data;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">bool</span> flag = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;ans = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// node 1</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(cvalue ><span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">9</span>){ <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//進位</span>pre = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();pre->data =cvalue%<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;ans->next = pre;ans->data = <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;p=pre;}<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">if</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(9 == cvalue)</span></span>{<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//最高位為9</span>flag = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>;ans->data =cvalue;pre= ans;p=pre;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{ans->data =cvalue;p = pre= ans;}q1=q1->next;q2=q2->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(q1 && q2){<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// the following node</span>q = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();pre->next = q;cvalue = q1->data+ q2->data;q->data =cvalue%<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(cvalue > <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">9</span> ){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(flag){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(p != ans){p->data += <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//999...[],前面全是9</span>Node*temp = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();temp->data= <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;temp->next= ans;flag =<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;ans =temp;p = ans;}}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{p->data +=<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">for</span>(p=p->next;p!=q;p=p->next){p->data =<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>;}}<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">if</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(cvalue <9)</span></span>{p = q;}pre = q;q1=q1->next;q2=q2->next;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> ans; }

參考:http://hawstein.com/posts/add-singly-linked-list.html,第二種實現不錯


b、 元素個數不一定相同,高位在后,個位在鏈表頭結點。1->2->3 ,?4->5->3->4,得5->7->6->4.

思路:需要注意的是,鏈表為空,有進位,鏈表長度不一樣。

<span class="hljs-preprocessor" style="border: 0px; margin: 0px; padding: 0px; font-weight: bold; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(153, 153, 153); background: transparent;">#<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">include</span> <assert.h></span> <span class="hljs-preprocessor" style="border: 0px; margin: 0px; padding: 0px; font-weight: bold; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(153, 153, 153); background: transparent;">#<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">include</span> <iostream></span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">using</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">namespace</span> <span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">std</span>; <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">struct</span> Node{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> data;Node *next; }; Node* create_list(<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> arr[],<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> len){assert(arr &&len><span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>);Node *head = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();head->data = arr[<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>];Node *cur=NULL;Node *pre=head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">for</span>(<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> i=<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;i<len;++i){cur = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node();cur->data =arr[i];pre->next = cur;pre = cur;}cur->next = NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> head; } Node* merge_list_add(Node *list1,Node *list2){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(NULL == list1) returnlist2;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(NULL == list2) returnlist1;Node *ans=NULL,*pre=NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> c=<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>;<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//進位</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> value = <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(list1 &&list2){value =list1->data +list2->data + c;Node* temp = newNode();temp->data =value%<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;c = value/<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(pre){pre->next =temp;pre = temp;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>ans=pre=temp;list2 = list2->next;list1 =list1->next;} <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!list1 &&!list2 && c><span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>){<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//兩個鏈表長度一樣,但有進位</span>Node* temp = newNode();temp->data = <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>;temp->next =NULL;<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//結束</span>pre->next = temp;}<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//有一個鏈表更長</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(list1){value =list1->data + c;Node* temp = newNode();temp->data =value%<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;c = value/<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;pre->next = temp;pre = temp;list1 =list1->next; }<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(list2){value =list2->data + c;Node* temp = newNode();temp->data =value%<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;c = value/<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">10</span>;pre->next = temp;pre = temp;list2 =list2->next; }pre->next = NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> ans; } <span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">main</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">()</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> a[]={<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">2</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">7</span>};<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> b[]={<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">4</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">5</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">3</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">9</span>,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">3</span>};<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//此處應該加個判斷,保證數組元素均在[0,9]</span>Node* lista =create_list(a,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">3</span>);Node* listb =create_list(b,<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">5</span>);Node* cur = lista;<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">"list a:"</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(cur != NULL){<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<cur->data<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">""</span>;cur = cur->next;}cur = listb;<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<endl<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">"listb: "</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(cur != NULL){<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<cur->data<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">""</span>;cur = cur->next;}<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<endl;Node *ans =merge_list_add(lista, listb);<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">for</span>(; ans; ans=ans->next)<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<ans->data<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">" "</span>;<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<endl; }


13用算法實現刪除鏈表的一個中間節點,所知的只有該節點的指針。如a-b-c-d-e中只知道c的指針,實現a-b-d-e。

思路:若直接刪除的話,鏈表就斷了,可是無法得到節點c的前驅b。故可轉換思路利用c的后繼d。將d的值賦給c, 然后將后繼節點d刪除,也就實現刪除操作。

由于c的位置不定,得分情況討論。一、c為普通的中間節點,用上述方式解決。二,c為頭節點,用上述方式解決。三、c為尾節點,一般認為刪除即可,但是會出現問題。刪除之后,尾節點的前驅不為空,下次遍歷就會出錯,特別注意。四、c為空節點,直接返回。

實現:

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">bool</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">remove_elem</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node* node)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!node || !node->next) returnfalse;Node *post = node->next;node->data = post->data;node->next = post->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">delete</span> post;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>; }

擴展:

a、Google題目,給定單向鏈表的頭指針和一個結點指針,定義一個函數在O(1)時間刪除該結點

思路跟前面的一致,同樣要注意尾節點。

?

b、只給定單鏈表中某個結點p(非空結點),在p前面插入一個結點。

思路:首先分配一個結點q,將q插入在p后,接下來將p中的數據copy入q中,
然后再將要插入的數據記錄在p中。


14、環鏈表開始節點,1->2->5->4->2

思路:

1、????????用快慢指針,滿指針1,快指針2。

我們注意到第一次相遇時,指針走過的路程S1 = 非環部分長度 + 弧A長

快指針走過的路程S2 = 非環部分長度 + n * 環長 + 弧A長

S1 * 2 = S2,可得 非環部分長度 = n * 環長 - 弧A長

讓指針1到起始點后,走過一個非環部分長度,指針2過了相等的長度。

就是n * 環長 - 弧A長,正好回到環的開頭。

或者參考:http://blog.csdn.net/lalor/article/details/7628332

?2、 ? ? 更簡單直觀的方法就是利用哈希表。無環的話,每個地址就是不一樣;有環的話,兩個地址一樣的就是環開始節點。下面用c++的map實現

std::map<Node*, bool>hash;

Node* loop_start(Node* node){

? while(node){

? ??? if(hash(node))?

????????? return node;

????? else{

????????? hash(node) = true;

????????? node = node->next;

????? }

? }

? return NULL; //return head ;??same

}

15、如何知道環的長度

?

一、在環上相遇后,記錄第一次相遇點為pos,之后指針slow繼續每次走1步,fast每次走2步。在下次相遇的時候fastslow正好又多走了一圈,也就是多走的距離等于環長。

  設從第一次相遇到第二次相遇,設slow走了len步,則fast走了2*len步,相遇時多走了一圈:環長=2*len-len。

二、利用哈希表,即兩個碰撞元素間的個數


16、輸入一個鏈表的頭結點,從尾到頭反過來打印出每個結點的值。

思路:用棧實現。

進階:用遞歸。實現如下:

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">PrintListReversingly</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(ListNode*pHead)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(pHead != NULL){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(pHead->m_pNext != NULL){PrintListReversingly(pHead->m_pNext);}<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">printf</span>(<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">"%d\t"</span>,pHead->m_nValue);} }

注意:但使用遞歸就意味著可能發生棧溢出的風險,尤其是鏈表非常長的時候。所以,基于循環實現的棧的魯棒性要好一些。


17輸入兩個遞增鏈表,合并為一個遞增鏈表。

思路:遍歷兩個鏈表,依次比較,形成新的隊列

進階:遞歸,每次遞歸返回合并后新鏈表的頭結點

list_node*List::recursive_merge(list_node * a,list_node * b){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(a == NULL)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> b;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(b == NULL)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> a;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(a->value <= b->value){a->next=recursive_merge(a->next,b);<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> a;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(a->value > b->value){b->next=recursive_merge(a,b->next);<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> b;} }

18用鏈表實現約瑟夫環

這里就不實現了。

?

19、判斷一條單向鏈表是不是回文1-2-4-2-1

思路:對于單鏈表結構,可以用兩個指針從兩端或者中間遍歷并判斷對應字符是否相等。但這里的關鍵就是如何朝兩個方向遍歷。

由于單鏈表是單向的,所以要向兩 個方向遍歷的話,可以采取經典的快慢指針的方法,即定位到鏈表的中間位置,再將鏈表的后半逆置,最后用兩個指針同時從鏈表頭部和中間開始同時遍歷并比較即可。

實現:(注意鏈表元素的奇偶性,稍微不同)

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">bool</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">is_list_plalindrome</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node*head)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!head)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;Node *one=head,*two=head,*pre=NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(two!=NULL && two->next!=NULL){pre=one;one = one->next;two = two->next->next;}<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//if length of list is odd, mid</span>Node *subhead=NULL,*node=NULL,*post=NULL;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!two){ <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//even,two==NULL</span>subhead = one;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{ <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//odd</span>subhead=one->next;}node=subhead;post=node->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(node->next){<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// rotate sublist (旋轉的這種寫法,很容易理解)</span>node->next = post->next;post->next = subhead;subhead = post;post = node->next;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">for</span>(Node*p=head,*q=subhead;p!=pre->next;p=p->next,q=q->next){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(p->data!=q->data)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">false</span>;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">true</span>; }


20、從尾到頭輸出鏈表。

題目:輸入一個鏈表的頭結點,從尾到頭反過來輸出每個結點的值。

思路:跟輸出倒數第n個元素的方法類似。

方法一、先把鏈表反向,然后再從頭到尾遍歷一遍。但該方法需要額外的操作

方法二、設一個棧,從頭到尾遍歷一次,把結點值壓力棧中,再出棧打印。

方法三、遞歸。

實現:

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">list_out_reverse</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node*head)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!head)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span>;<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span><span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">list_out_reverse</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(head->next)</span></span>;<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<head->data<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">" "</span>; }

擴展:該題還有兩個常見的變體:

1. 從尾到頭輸出一個字符串;

2. 定義一個函數求字符串的長度,要求該函數體內不能聲明任何變量。

兩個的分別實現:

<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">reverseString</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(conststring& s,<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">unsigned</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> begin)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!s.size())<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(begin>=s.size())<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span>;reverseString(s,begin+<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>);<span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">cout</span><<s[begin]<<<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">" "</span>; }
<span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">getLength</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">const</span> <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">char</span> *s)</span></span>{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(*s==<span class="hljs-string" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(33, 145, 97); background: transparent;">'/0'</span>)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">0</span>;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> getLength(s+<span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>) + <span class="hljs-number" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(64, 160, 112); background: transparent;">1</span>; }

21、鏈表和數組的區別?

分析:主要在基本概念上的理解。但是最好能考慮的全面一點,現在公司招人的競爭可能就在細節上產生,誰比較仔細,誰獲勝的機會就大。

數組無需初始化,因為數組的元素在內存的棧區,系統自動申請空間。而鏈表的結點元素在內存的堆區,每個元素須手動申請空間,如malloc。也就是說數組是靜態分配內存,而鏈表是動態分配內存。鏈表如此麻煩為何還要用鏈表呢?數組不能完全代替鏈表嗎?回到這個問題只需想想我們當初是怎么完成學生信息管理系統的。為何那時候要用鏈表?因為學生管理系統中的插入,刪除等操作都很靈活,而數組則大小固定,也無法靈活高效的插入,刪除。

數組是線性結構,靜態分配內存,在內存中連續,數組元素在棧區??梢灾苯铀饕?#xff0c;時間復雜度O(1)。數組插入或刪除元素比較困難,時間復雜度O(n)。

鏈表也是線性結構,動態分配內存,在內存中不連續,鏈表元素在堆區。元素的定位均需遍歷,時間復雜度O(n)。鏈表插入或刪除元素操作靈活性強,時間復雜度O(1)。

?

?

22、編寫實現鏈表排序的一種算法。說明為什么你會選擇用這樣的方法?

思路:如果只是數據內容之間的相互交換,那么這種排序方法也比較適合鏈表的排序,插入、冒泡、希爾和選擇排序。快速排序、合并排序、堆排序都涉及到了中間值的選取問題,所以不大適合鏈表排序。

選擇排序的實現:

Node* insert_sort(Node *head){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(!head ||!head->next)<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> head;Node *p,*q,*pre,*temp;p=head->next;head->next=NULL;<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// p is the head of unsorted list</span><span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// head is the head of sorted list</span><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(p){q=head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(q &&(q->data < p->data)){pre=q;q=q->next;}temp = p->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(q==head){p->next = q;head = p;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">else</span>{pre->next=p;p->next = q;}p=temp;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> head; }

其他排序參考:http://www.voidcn.com/blog/Hackbuteer1/article/p-999842.html

http://wenku.baidu.com/link?url=CxhR7E5PGrEwRU5eKu_3xX5EvZ6MP-7GhRLhAfoQFThh5HxlQ5SgIxdfRPVXRO-oeCkwFYFqLJJezeswxdOmRE4W_QJBY3iS4Xpot23XCPi


23、復雜鏈表的復制(默認無環)

Q:有一個復雜鏈表,其結點除了有一個m_pNext指針指向下一個結點外,還有一個m_pSibling指向鏈表中的任一結點或者NULL。請完成函數ComplexNode* Clone(ComplexNode* pHead),以復制一個復雜鏈表。

一開始想這道題毫無思路,如果蠻來,首先創建好正常的鏈表,然后考慮sibling這個分量,則需要O(n^2)的時間復雜度。

思路一: 一般復制一個簡單鏈表就這么遍歷一遍就好了,這個復雜鏈表,比簡單鏈表多的地方就在于多了一個sibling的指針,也就是說在建立完簡單鏈表之后,如何在新的鏈表中找到sibling對應的地址。我們已知的是舊的節點的地址,所以只需要用一個map,保存每一個節點舊的節點對應的新的節點的地址即可。(即將原鏈表中的結點N和相應復制結點N'建立哈希映射<N,N'>

第一次遍歷,建立簡單節點,第二次遍歷,對于舊鏈表中的每一個節點的sibling指針地址,從map中找到新鏈表中對應節點的地址,連接上就好了。

實現:(不錯的實現,學習

ComplexNode* Clone(ComplexNode*pHead){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(pHead == NULL) <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> NULL;<span class="hljs-stl_container" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-built_in" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 134, 179); background: transparent;">map</span><ComplexNode*, ComplexNode*></span>pointMap;ComplexNode* newHead,*tail; <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// newHead指向復制的新鏈表的開頭,tail始終指向結尾</span><span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// 開辟一個頭結點</span>newHead = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> ComplexNode;newHead->value = pHead->value;newHead->pNext = NULL;newHead->pSibling = NULL;pointMap[pHead] = newHead; <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// 將頭結點放入map中</span>tail = newHead;ComplexNode *p = pHead->pNext;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(p != NULL){ <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// 第一遍先將簡單鏈表復制一下</span>ComplexNode* newNode = <span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> ComplexNode;newNode->value = p->value;newNode->pNext = NULL;newNode->pSibling = NULL;tail->pNext = newNode;tail = newNode;pointMap[p] = newNode;p = p->pNext;}<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">// 根據map中保存的數據,找到對應的節點</span>p = pHead;tail = newHead;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(p!=NULL){<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(p->pSibling!=NULL){tail->pSibling =pointMap.find(p->pSibling)->second;<span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//Key,找N對應的N’</span>}p = p->pNext;tail = tail->pNext;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> newHead;}

?

思路二:(精妙)一個技巧便可以巧妙的解答此題??磮D便知。

首先是原始的鏈表


然后我們還是首先復制每一個結點N為N*,不同的是我們將N*讓在對應的N后面,即為


然后我們要確定每一個N*的sibling分量,非常明顯,N的sibling分量的next就是N*的sibling分量。

最后,將整個鏈表拆分成原始鏈表和拷貝出的鏈表。

這樣,我們就解決了一個看似非?;靵y和復雜的問題。

實現:

<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">struct</span> Node{<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">int</span> val;Node* next;Node*sibling; }; <span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">Clone</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node* head)</span></span>{Node*current=head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(current){Node*temp=<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">new</span> Node;temp->val=current->val;temp->next=current->next;temp->sibling=NULL;current->next=temp;current=temp->next;} } <span class="hljs-function" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; background: transparent;"><span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">void</span> <span class="hljs-title" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(25, 70, 157); background: transparent;">ConstructSibling</span><span class="hljs-params" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 0, 255); background: transparent;">(Node*head)</span></span>{Node*origin=head;Node*clone;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(origin){clone=origin->next;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(origin->sibling)clone->sibling=origin->sibling->next;origin=clone->next;} }Node* Split(Node* head){Node*CloneHead,*clone,*origin;origin=head;<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">if</span>(origin){CloneHead=origin->next;origin->next=CloneHead->next;origin=CloneHead->next;clone=CloneHead;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">while</span>(origin){Node*temp=origin->next;origin->next=temp->next;origin=origin->next;clone->next=temp;clone=temp;}<span class="hljs-keyword" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; color: rgb(149, 65, 33); background: transparent;">return</span> CloneHead; } <span class="hljs-comment" style="border: 0px; margin: 0px; padding: 0px; font-weight: inherit; font-style: italic; font-family: inherit; vertical-align: baseline; color: rgb(64, 128, 128); background: transparent;">//the whole thing</span> Clone(head); ConstructSibling(head); <p>Split(head);</p><p> </p><p>轉載自:http://www.voidcn.com/blog/ywok526/article/p-2520659.html</p>

總結

以上是生活随笔為你收集整理的链表面试笔试题目总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

久久高清视频免费 | 天天爽夜夜爽人人爽一区二区 | 国产成人精品一区二三区 | 日本狠狠干 | 日韩精品免费在线视频 | 91亚洲精品久久久蜜桃网站 | 国产一区二区三区久久久 | 最新日韩在线观看视频 | 极品久久久久 | 久久免费激情视频 | 色婷婷导航 | 国产精品高清免费在线观看 | 亚州精品在线视频 | 久久99国产精品久久99 | 国产小视频在线看 | 日韩中字在线 | 午夜色婷婷 | 日韩乱理 | 草久热 | 成人综合免费 | 久草在线官网 | 国产中文字幕国产 | 国产高清视频在线免费观看 | 国产精品久久久久久久久久久久冷 | 人人人爽| 中文字幕永久免费 | 国产精品久久久一区二区 | 91麻豆高清视频 | 99久e精品热线免费 99国产精品久久久久久久久久 | 国产中的精品av小宝探花 | 免费一级毛毛片 | 婷婷5月激情5月 | 91九色精品女同系列 | 久久免费av电影 | 2022中文字幕在线观看 | a级免费观看 | 色综合久久久久综合体 | 久久免费a | 欧美午夜精品久久久久久浪潮 | 国产精品网红直播 | 日韩激情小视频 | 久久精品中文字幕一区二区三区 | 久久国产一区二区三区 | 91豆花在线观看 | 天天射天天操天天色 | 四虎伊人 | 国产麻豆精品久久一二三 | 国产亚洲视频在线 | www婷婷| 国产精品亚洲片在线播放 | 激情喷水 | 亚洲精品网站 | 国内久久精品 | 亚洲人人爱 | 亚洲一区二区视频在线播放 | 色妞色视频一区二区三区四区 | 在线免费观看视频a | 国内精品久久久久久久久久久 | 国产经典av | 在线观看资源 | 日韩一级网站 | 欧美国产日韩在线观看 | 亚洲精品www久久久久久 | 香蕉97视频观看在线观看 | 国产一线二线三线在线观看 | 人人插人人玩 | 一本到视频在线观看 | 久久看免费视频 | 日免费视频 | 国产精品毛片一区二区三区 | 精品国产一区二 | 国产在线视频导航 | 人人舔人人射 | 操操色 | 99久久超碰中文字幕伊人 | 久久99精品国产 | 激情欧美日韩一区二区 | 麻豆国产在线播放 | 日本久久久久久久久 | 日韩成人欧美 | 天天插日日操 | 亚洲天堂网视频在线观看 | 久久久久看片 | 97超碰国产精品 | 中文字幕一区2区3区 | 激情欧美丁香 | 成人av一区二区兰花在线播放 | 国产精品video爽爽爽爽 | 香蕉视频久久久 | 日本久久精品视频 | 超碰在线人人爱 | 狠狠干婷婷色 | 中文字幕av在线免费 | 日韩高清激情 | 久久免费视频4 | 亚洲精品视频观看 | 人人爽人人澡人人添人人人人 | 蜜臀av.com| 最新日韩电影 | 国产精品热 | 91在线在线观看 | 中文字幕在线观看91 | 精品久久久久国产 | 黄色a在线 | 欧美成人在线免费观看 | 在线亚洲午夜片av大片 | 色婷婷www| 亚洲精选视频在线 | 亚洲欧洲精品一区 | 超碰人人在 | 最近中文字幕国语免费高清6 | 97超碰资源站 | 亚洲最新av在线网址 | 国产视频高清 | 天天干天天操天天做 | 天天干夜夜爱 | 五月天久久精品 | 亚洲精品国产品国语在线 | 久久综合9988久久爱 | 在线观看免费视频 | 精品亚洲免费视频 | 日本中文字幕电影在线免费观看 | av中文在线 | 一区二区三区四区久久 | 蜜臀av性久久久久蜜臀aⅴ涩爱 | 不卡视频一区二区三区 | 日本黄色免费在线 | 99久国产| 国产精品自产拍在线观看网站 | 国产精品theporn | 夜夜躁天天躁很躁波 | 久久乱码卡一卡2卡三卡四 五月婷婷久 | 亚洲最新av网站 | 91热视频在线观看 | 麻豆91在线播放 | 成人在线播放视频 | 亚洲国产午夜视频 | av在线免费观看不卡 | 在线观看香蕉视频 | 少妇精69xxtheporn | 最近免费在线观看 | 安徽妇搡bbbb搡bbbb | 亚洲区视频在线 | 久久歪歪 | 日韩一级电影在线 | 狠狠操狠狠 | 精品国产美女 | 中文字幕视频网站 | 碰天天操天天 | 日本久久高清视频 | 叶爱av在线 | 成人app在线免费观看 | 日韩在线一区二区免费 | 中文字幕观看av | 久久婷婷综合激情 | 久久亚洲精品电影 | 免费h精品视频在线播放 | 国产不卡在线视频 | 五月天激情婷婷 | www激情com| 毛片永久新网址首页 | 久久国产精品一区二区三区 | 欧美 日韩 性 | 欧美成a人片在线观看久 | 亚洲尺码电影av久久 | 九九免费精品 | 日韩美女av在线 | 国产精品久久久久久久久久久久久 | 亚洲综合网站在线观看 | 嫩嫩影院理论片 | 精品伊人久久久 | 国产精品久久久久高潮 | 久草网视频| 91伊人久久大香线蕉蜜芽人口 | 69中文字幕 | 国产麻豆果冻传媒在线观看 | 999久久国产精品免费观看网站 | 日韩午夜在线观看 | 国产1区2区 | 成人av在线一区二区 | 国产亚洲精品久久久久久网站 | 色网av | 免费在线电影网址大全 | 国产成人三级三级三级97 | 97超碰人人干 | 中文字幕制服丝袜av久久 | 韩国三级av在线 | 日韩中文字幕亚洲一区二区va在线 | 成人网页在线免费观看 | 色视频网站在线观看一=区 a视频免费在线观看 | 国产成人精品不卡 | 天天操夜夜逼 | 天天夜操 | 天天操天天舔天天爽 | 亚洲美女精品区人人人人 | 又爽又黄又无遮挡网站动态图 | 99久久毛片| 国产一卡二卡在线 | 日韩欧美精品在线视频 | 黄污视频大全 | 六月色婷| 免费大片av| 国产二区精品 | 日韩视频免费看 | 久久在线精品视频 | 久久一区二区三区国产精品 | 中文永久字幕 | 国产一区在线免费观看 | 日本公妇在线观看高清 | 欧美激情综合五月色丁香 | 国产视频在线免费 | 99精品在这里 | 国产黄色片在线免费观看 | 免费看一及片 | 91传媒在线播放 | 911免费视频 | 91精品啪在线观看国产81旧版 | 美女性爽视频国产免费app | 亚洲午夜精品在线观看 | 欧美精品亚洲精品 | 成人蜜桃视频 | 日本精a在线观看 | 人人草网站 | 国产精品女主播一区二区三区 | 久久久国产精品一区二区中文 | 天天操夜夜操国产精品 | 夜夜狠狠 | 欧美一级黄色视屏 | 97在线看片 | 在线а√天堂中文官网 | 麻豆传媒视频在线 | 亚洲精品国产精品乱码在线观看 | 在线视频观看成人 | 日韩精品在线播放 | 午夜天天操 | 日韩小视频 | 欧美日韩激情视频8区 | 日韩v在线91成人自拍 | 深爱激情五月综合 | 天天干天天操天天搞 | 最近最新中文字幕视频 | 中文在线a√在线 | 国产高清专区 | 日日夜夜婷婷 | 久久久高清一区二区三区 | 在线视频欧美精品 | 波多野结衣在线视频一区 | 国产成人精品一区二区三区网站观看 | 国产日产精品一区二区三区四区 | 免费裸体视频网 | 在线观看免费版高清版 | 亚洲午夜精品在线观看 | 成人午夜影院在线观看 | 国产精品18久久久久久不卡孕妇 | 成人久久18免费网站麻豆 | 日韩精品中文字幕在线不卡尤物 | 日韩网| www免费看片com| 1024手机在线看 | 精品国产久 | 婷婷六月天天 | 免费看三级黄色片 | 亚洲毛片视频 | 在线日韩av| 国产精品亚洲综合久久 | 日韩在线免费看 | 午夜性色| 国产精品久久久久久久免费大片 | 99国产视频 | 久久精品美女 | 久久99免费观看 | 草久久久| 狠狠狠狠狠狠 | 国产黄色免费在线观看 | 久草国产精品 | 在线观看视频你懂的 | 高清在线一区 | 97超碰在线免费 | 精品999在线 | 视频在线播放国产 | 成年人在线免费看片 | a在线观看视频 | 国产精品久久二区 | 五月婷婷在线播放 | 亚洲精品久久久久中文字幕m男 | 青春草免费在线视频 | 成人一区二区三区在线观看 | 久久永久免费视频 | 久久国产精品免费 | 激情伊人五月天久久综合 | 亚洲欧美视频在线播放 | 国产伦精品一区二区三区四区视频 | 国产在线播放一区二区三区 | 99国产精品久久久久久久久久 | 中文字幕在线观看第三页 | 麻豆久久 | 亚洲精品在线观看的 | 天天色宗合 | 国产精品一区二区免费 | 欧美韩日精品 | 国产理论免费 | 久久九九九九 | 免费一级片久久 | 国产精品自产拍在线观看网站 | 免费亚洲视频在线观看 | 97精品在线 | 日韩欧美在线免费观看 | 天天综合网天天综合色 | 久久看毛片 | 欧美日韩不卡一区二区三区 | 久久精品国产精品亚洲精品 | 日日干夜夜爱 | 午夜av免费 | 日韩成人免费在线电影 | 亚洲 欧美 综合 在线 精品 | a黄色一级 | 日韩一区精品 | 国产精品视屏 | 99福利片| 中文字幕av日韩 | 福利视频第一页 | 9999精品免费视频 | 欧美成人va| 九色在线视频 | 九九热只有精品 | 中文字幕三区 | 国内精品久久久久久久 | 国产综合精品一区二区三区 | 手机在线观看国产精品 | 亚洲精品99久久久久中文字幕 | 中文字幕免费一区二区 | 97超碰人人澡人人爱学生 | 成人一级电影在线观看 | 国产一区二区精品在线 | 欧美日韩国产亚洲乱码字幕 | 亚洲一级黄色大片 | 国产精品一区二区精品视频免费看 | 国产伦理一区二区三区 | 天天操天天是 | 92av视频 | 高潮久久久久久久久 | 国产91在线观 | 狠狠色丁香久久婷婷综合五月 | 久久精品电影 | www..com黄色片| 久草在线视频免赞 | 四虎国产精 | 日日操日日插 | 婷婷香蕉| 日韩高清一区在线 | 亚洲精品国产高清 | 午夜av电影院 | av大全在线 | 一级电影免费在线观看 | 午夜视频在线观看一区二区 | 欧美黄网站| 国产亚洲成人网 | 久草电影在线观看 | 亚洲成人中文在线 | 成人欧美在线 | 91av电影网| 人人擦| 国产精品h在线观看 | 天天射天天干天天 | 91视频-88av| 91精品国产自产在线观看永久 | 麻豆国产精品一区二区三区 | av福利第一导航 | 亚洲欧美日韩国产一区二区 | 人人爽人人澡人人添人人人人 | 91成人国产 | 精品99视频 | 中文字幕av免费在线观看 | 91精品免费看 | 婷婷色网址 | 在线免费亚洲 | 日韩精品一区二区不卡 | 99色在线观看| 久久久影院一区二区三区 | 色噜噜日韩精品一区二区三区视频 | 久久国产精品一国产精品 | 91福利视频久久久久 | 亚洲一级电影在线观看 | 国产精品精品国产色婷婷 | av在线播放国产 | 色婷婷亚洲 | 性日韩欧美在线视频 | www.久久色| 天天干天天插伊人网 | 国产一线二线三线性视频 | 中文字幕在线成人 | 精精国产xxxx视频在线播放 | 免费视频 三区 | 日韩免费在线 | 夜夜躁日日躁狠狠久久88av | 国产精品毛片久久久久久久久久99999999 | 91亚洲精品在线观看 | 日本久草电影 | 五月天免费网站 | 日韩在线视频线视频免费网站 | 精品亚洲视频在线 | av一区二区三区在线播放 | 蜜桃av人人夜夜澡人人爽 | 在线观看视频99 | 日韩精品久久久久久 | 91九色性视频 | 欧美精品资源 | 精品美女视频 | 又黄又爽的免费高潮视频 | 97在线观看免费高清完整版在线观看 | 亚洲日本一区二区在线 | 亚洲精品视频在线播放 | 国产视频中文字幕在线观看 | 97天堂 | 日韩中文字幕视频在线观看 | 九九热在线视频免费观看 | 一色屋精品视频在线观看 | 日韩欧美成人网 | 中文字幕免费高清在线观看 | 又污又黄网站 | 91精品视频一区二区三区 | 欧美性视频网站 | 久久专区| 色综合婷婷 | 午夜视频在线网站 | 天天干天天操天天射 | 欧美男同网站 | www国产亚洲精品久久网站 | 久草在线观看资源 | 97超碰香蕉 | 天天操天天色天天 | 青草视频在线看 | 亚洲精品mv在线观看 | 天天插日日操 | 久久久久久网站 | 最近更新好看的中文字幕 | 在线观看国产日韩 | 91av免费在线观看 | 国产超碰在线 | 五月激情片 | 色操插 | 91久久人澡人人添人人爽欧美 | 91在线免费视频观看 | 69夜色精品国产69乱 | 日本中文字幕在线播放 | 黄色成人av | 悠悠av资源片 | 四虎免费av | 日本高清xxxx| 国产精品毛片久久 | 婷婷精品国产欧美精品亚洲人人爽 | 国产精品一区二区 91 | 国产麻豆精品在线观看 | 国内精品久久久久影院一蜜桃 | 欧美视频日韩 | 日日爱网站 | 最新日韩中文字幕 | 国产精品99久久久久久久久 | 丁香花在线视频观看免费 | 午夜久久福利视频 | 日韩欧美在线观看一区二区 | 国产黄色视 | 97视频人人 | 不卡国产在线 | 亚州国产精品久久久 | 激情欧美一区二区三区 | 欧美色插 | 日韩在线字幕 | 欧美一区二区三区在线 | 国产精品久久久久久久久久不蜜月 | 日p在线观看 | 国产精品久久久久国产精品日日 | 久久午夜视频 | 久久免费视频国产 | 91在线视频导航 | 九九久久精品 | 久久一精品 | 亚洲欧美日韩精品久久奇米一区 | av在线免费在线观看 | 99免费在线播放99久久免费 | 成人精品一区二区三区中文字幕 | 在线免费观看国产视频 | 在线观看中文字幕一区二区 | av大片免费在线观看 | 午夜视频播放 | 五月天色网站 | 国产在线观看你懂得 | 色婷婷激婷婷情综天天 | 性色视频在线 | 国产精品第52页 | av先锋影音少妇 | 人人超碰人人 | 亚洲精品国精品久久99热 | 午夜久久影视 | 欧洲亚洲激情 | 日本精品久久 | 精品夜夜嗨av一区二区三区 | 最新日韩中文字幕 | 丁香六月色 | 久久精品亚洲国产 | 国产免费影院 | 国产精品久久在线观看 | 四虎免费av| 在线黄色国产 | 国产激情电影综合在线看 | 最近中文字幕在线中文高清版 | 国产午夜亚洲精品 | 日韩欧美视频一区二区 | 久久久久久久久电影 | 顶级bbw搡bbbb搡bbbb | 久久免费看毛片 | www蜜桃视频 | 欧美十八 | 亚洲六月丁香色婷婷综合久久 | 二区三区在线 | 色噜噜在线观看视频 | 久久免费视频在线观看 | 在线免费观看黄色小说 | 久久综合九色综合久99 | 中文字幕 二区 | 91久久精品一区二区三区 | 久久久久久久久久久综合 | 久久久一本精品99久久精品66 | 免费在线观看日韩 | 亚洲国产成人高清精品 | 成人在线小视频 | 在线观看第一页 | www免费黄色| 手机成人在线 | 久一久久 | 激情中文在线 | 精品国产乱码久久久久久三级人 | 久久免费视频8 | 免费一级片在线 | 免费观看91| 免费亚洲片 | 色鬼综合网 | 欧美日韩一区三区 | 精品在线99 | 亚洲日本va中文字幕 | 日日夜夜91 | 日韩成人精品在线观看 | 亚洲播播 | 狠狠狠色丁香综合久久天下网 | 国产成人精品亚洲日本在线观看 | 国产精品视频在线观看 | 免费看一级 | 亚洲视频电影在线 | 午夜色影院 | 国产精品福利在线观看 | 美女网站在线观看 | 欧美精品一区在线发布 | 久久久久久久影院 | 国产美女主播精品一区二区三区 | 色天天中文 | 中文字幕在 | 久久久久久久久影院 | 日韩av中文字幕在线免费观看 | 国产人成在线视频 | 国产精品久久久久久久久久ktv | 午夜精品福利一区二区三区蜜桃 | 亚洲国产av精品毛片鲁大师 | 亚洲国产天堂av | 亚洲成人欧美 | 久久久免费精品国产一区二区 | 欧美精品久久天天躁 | 亚洲欧美经典 | 国产精品二区三区 | 国产手机在线观看视频 | 久久99亚洲网美利坚合众国 | 免费在线观看午夜视频 | 最新精品视频在线 | 四虎8848免费高清在线观看 | 国产日韩精品久久 | 麻豆网站免费观看 | 成人a视频片观看免费 | 日韩影片在线观看 | 97在线免费 | 狠狠色噜噜狠狠 | 国产精品美女久久久网av | 久久精品久久久久久久 | 在线播放日韩av | 四虎国产永久在线精品 | 青草视频在线看 | 国产精品免费视频观看 | 久久艹影院 | 黄a在线看| 久久er99热精品一区二区三区 | 亚洲另类xxxx | 在线观看久 | 欧美日本在线视频 | 国产99免费| 一区二区欧美在线观看 | 久草免费在线视频 | 天天爽天天搞 | 中文字幕在线观看第三页 | 91精品久久久久久久久久久久久 | 四虎国产精| 99成人在线视频 | 天天操天天操天天操天天 | 欧美日韩免费一区 | 激情婷婷在线 | www.久久免费 | 99999精品视频 | 久久精品99精品国产香蕉 | 久久精品一二三区白丝高潮 | 国产一区高清在线 | 黄av免费在线观看 | 香蕉视频亚洲 | 欧美日韩免费一区二区 | 日日干视频 | 日本免费一二三区 | 欧美综合在线视频 | 免费a网| 五月婷婷狠狠 | 毛片网站在线看 | 黄色一级大片在线免费看国产一 | 黄色在线成人 | 精品国自产在线观看 | 国产精品18久久久久久不卡孕妇 | 九色自拍视频 | av线上看| 97在线免费 | 日韩三级在线 | 精品福利在线观看 | 久久视频在线看 | 国模精品在线 | 欧美精彩视频在线观看 | 激情六月婷婷久久 | 99视频在线看 | 99精品视频在线观看 | 日韩大片在线播放 | 国产精品国产三级国产不产一地 | 少妇激情久久 | 久久精品三级 | 中文字幕在线免费观看视频 | 久久国产精品久久w女人spa | 日韩av手机在线看 | 久久激情综合网 | 四虎影视成人精品国库在线观看 | 免费看色视频 | 欧美日韩国产在线精品 | 在线观看黄网站 | 久青草影院| 在线视频手机国产 | 美女视频黄是免费的 | 日本精品在线 | 久久电影日韩 | 亚洲欧美日韩国产 | 久热色超碰 | 亚洲精品一区中文字幕乱码 | 欧美日韩免费一区二区三区 | 久久精品直播 | 国产高清免费在线观看 | 成人av日韩| 狠狠干婷婷色 | 国产精品久久久久久久久久久免费看 | 国产精品男女视频 | 91插插影库 | 黄色av网站在线免费观看 | 欧美精品一区二区在线播放 | 亚洲精品一区二区三区四区高清 | 97精品国产97久久久久久免费 | 亚洲免费一级 | 超碰在线观看av.com | 又湿又紧又大又爽a视频国产 | 99r在线 | 国产成人精品一区二区三区 | 国产高清视频免费在线观看 | 97精品国产97久久久久久春色 | www.亚洲精品| 玖玖玖精品 | 亚洲精品中文字幕在线 | 久久人人干| 国产91精品看黄网站在线观看动漫 | 欧美最猛性xxxxx亚洲精品 | 天天亚洲综合 | 国产亚洲精品久久久久久无几年桃 | 欧美日韩高清在线观看 | 欧美日韩在线免费视频 | 99re亚洲国产精品 | 国产一区视频免费在线观看 | 国产99久久久国产精品免费二区 | 国产高清视频在线播放 | 久久国产精品视频免费看 | 久久精品视频中文字幕 | 四虎国产 | 99热在线国产精品 | www..com毛片 | 日韩在线电影 | 久久人人97超碰精品888 | 日韩动态视频 | 欧美人操人 | 天天草综合网 | 亚洲国产影院 | 天堂av免费看 | 欧美少妇xxx| 99精品视频在线观看视频 | .精品久久久麻豆国产精品 亚洲va欧美 | 久久久午夜精品福利内容 | 日韩免费视频观看 | 亚洲情婷婷 | 在线一二区| 国产精品国内免费一区二区三区 | 亚洲1级片 | 欧美一区二区免费在线观看 | 韩国av一区二区三区在线观看 | 午夜精品福利一区二区三区蜜桃 | 日韩欧美精品一区二区 | 国产精品久久在线观看 | 最近字幕在线观看第一季 | 日韩在线高清视频 | 制服丝袜在线91 | 九草视频在线 | 久久激情五月婷婷 | 成人久久18免费网站图片 | 97看片网 | 午夜国产一区二区三区四区 | 在线观看中文 | 国产色拍拍拍拍在线精品 | 99久国产 | 日韩精品免费一区二区在线观看 | 欧美午夜精品久久久久久浪潮 | 福利网址在线观看 | 天堂网av 在线 | 香蕉视频一级 | 日韩精品一区二区三区丰满 | 日韩有码中文字幕在线 | 日本精品中文字幕在线观看 | 操碰av | 美女视频黄的免费的 | 婷婷干五月 | 91豆麻精品91久久久久久 | 欧美在线91| 天天舔天天搞 | 五月激情站 | 成人免费看视频 | 日韩精品久久一区二区 | 国产精品毛片久久久久久久久久99999999 | 精品一区二区三区香蕉蜜桃 | 国产高清在线看 | 亚洲精品福利在线 | 激情五月婷婷综合网 | 人人插人人草 | 亚洲男男gaygayxxxgv| 国产资源网 | 99亚洲天堂| 欧美成人视| 日韩精品一区二区三区丰满 | 91精品视频一区 | 精品欧美在线视频 | 九九九热精品免费视频观看 | 亚洲激情六月 | 色91在线视频 | 在线国产中文字幕 | 中文字幕亚洲欧美日韩 | 1区2区3区在线观看 三级动图 | 亚州av成人 | 日韩欧美成| 日韩免费高清在线观看 | 干干操操 | 国产精品123 | 麻豆va一区二区三区久久浪 | 黄色av一区 | 欧美日韩免费视频 | 中文字幕成人网 | 亚洲精品一区二区三区新线路 | 在线观看亚洲成人 | 不卡的一区二区三区 | 亚洲综合色激情五月 | 精品国产一区二区三区不卡 | 国产精品日韩在线观看 | 日韩一二三在线 | 免费看三级| 一区二区视频在线观看免费 | 免费在线观看一级片 | 国产一区二区免费 | 九九精品毛片 | 国产精品免费不卡 | 黄色网在线免费观看 | 日韩av电影一区 | 久久男人影院 | 国产精品免费在线观看视频 | 日韩精品视频免费 | 成人99免费视频 | 69视频永久免费观看 | 国产精品成人一区 | 激情在线网 | www黄| 91亚洲精品久久久中文字幕 | 久久综合天天 | 免费视频 三区 | 日日操夜| 久久99热国产 | 亚洲一级黄色片 | 精品一区 在线 | 日韩精品在线一区 | 91久久精品一区二区三区 | 国产午夜精品久久久久久久久久 | 国产一区免费在线观看 | 日韩综合视频在线观看 | 亚洲精品乱码白浆高清久久久久久 | 手机av在线免费观看 | 欧美一级专区免费大片 | 日韩二区三区 | 男女啪啪网站 | 国产成人精品久久久久蜜臀 | 日日夜夜综合 | 国产视频在线观看一区 | 日本三级久久久 | 欧美专区亚洲专区 | 免费午夜视频在线观看 | 国内精品小视频 | 亚洲国产日韩av | 午夜av影院 | 91在线永久| 国产在线一区观看 | 亚洲第一av在线播放 | 天天天天天干 | 国产精品久久久久aaaa九色 | 国产系列在线观看 | 激情欧美网 | 青青草在久久免费久久免费 | 中文字幕第一页在线视频 | 久久久久久美女 | 亚洲乱码精品 | 韩日电影在线免费看 | av片在线观看免费 | 久久精品中文视频 | 国产精品久久久久久妇 | 精品国产欧美一区二区三区不卡 | 国产伦理一区二区三区 | 日韩高清一区在线 | 久草视频免费 | 久久伦理电影网 | 日韩精品一区在线观看 | 中文字幕精品三级久久久 | 欧美激情第一页xxx 午夜性福利 | 黄色精品久久 | 久久一久久 | 99久久久国产精品 | 午夜视频在线观看一区二区 | 精品国产成人av在线免 | 欧美成人按摩 | 视频直播国产精品 | 国产精品99久久久久的智能播放 | 天天操夜夜叫 | 久久看毛片 | 在线观看91久久久久久 | 日本中出在线观看 | 亚洲成av人片在线观看www | 亚洲高清国产视频 | 91av播放 | 国产在线精品区 | 日韩在观看线 | 在线免费观看国产精品 | 91麻豆精品国产91久久久久久久久 | 亚洲天天综合 | 超碰免费久久 | 人人插人人做 | www.黄色片.com | 亚洲片在线资源 | 色网站在线免费观看 | 精品国产美女 | 色婷婷久久久 | 在线成人小视频 | 91av电影| 成人一级影视 | 91av大全| 久久久精品小视频 | 日韩精品免费在线观看 | 欧美精品久久久久久久久老牛影院 | 国产精品1区2区3区 久久免费视频7 | 五月婷婷丁香综合 | 久久免费激情视频 | 丁香综合五月 | 天天干天天看 | 中文字幕在线观 | 亚洲九九 | 亚洲激精日韩激精欧美精品 | 黄色毛片电影 | 亚洲黄色网络 | 久久久一本精品99久久精品 | 在线看国产视频 | 国产精久久久久久妇女av | 激情伊人 | 91精品啪在线观看国产 | 国产精品毛片久久久久久久久久99999999 | 欧美黄色软件 | 国产91全国探花系列在线播放 | 天堂av在线7 | 久青草电影 | 国产一区二区在线视频观看 | 日韩在线网址 | 久久久久久久久久久久久久电影 | 91手机视频在线 | 亚洲精品美女在线观看播放 | 国产在线p | 亚洲资源在线观看 | 国产高清视频网 | 国产在线a免费观看 | 天天天色综合 | 黄色一级动作片 | 丁香 婷婷 激情 | 久久久高清一区二区三区 | 国产成人精品999 | 丁香久久激情 | 麻豆视传媒官网免费观看 | 成年人黄色免费视频 | 黄色小网站免费看 | 国内精品久久久久久 | 国内成人精品视频 | 国产资源在线免费观看 | 国产精品成久久久久三级 | 国产精品欧美久久久久无广告 | 成人久久18免费网站 | 久久男人免费视频 | 2021av在线 | 国产专区在线 | 久久 亚洲视频 | av久久在线 | 久久成人国产精品 | 最近更新中文字幕 | 国产一区二区三区久久久 | 久久精品久久久精品美女 | 国产va精品免费观看 | 人人澡人人爽欧一区 | 久久精品亚洲一区二区三区观看模式 | 337p西西人体大胆瓣开下部 | 中文字幕123区 | 日韩精品视频免费在线观看 | 国产精品福利在线观看 | 久久久精品久久日韩一区综合 | 日韩成人在线一区二区 | 一区二区中文字幕在线观看 | 日本在线观看一区 | 久草在线视频首页 | 日韩一区在线播放 | 日日夜夜亚洲 | 国产黄色资源 | 免费视频久久久 | 成年人免费看片 | 日本少妇视频 | 日韩av在线看 | 国产高清第一页 | 亚洲一级片免费观看 | 中文字幕中文 | 亚洲一区免费在线 | 国产一区二区久久久 | 激情六月婷婷久久 | 久久成人一区 | 美女视频一区二区 | 日韩黄色一级电影 | 色资源中文字幕 | 久草视频在线资源 | 国产精品mv | 久久亚洲美女 | 亚洲少妇自拍 | 国产玖玖视频 | av观看久久久 | 六月婷婷色 | 国产午夜激情视频 | 久久免费福利视频 | 18国产精品白浆在线观看免费 | 精品高清视频 | 久久久国产视频 | 日本在线观看黄色 | 日本成人中文字幕在线观看 | 91爱爱网址 | 在线观看av小说 | 国产精品自产拍在线观看桃花 | 香蕉网在线观看 | 在线观看一区 | 日韩精品免费在线观看视频 | 亚洲乱码久久久 | 久久精品综合 | 免费精品视频在线 | 93久久精品日日躁夜夜躁欧美 | 国产福利专区 | 亚洲va在线va天堂va偷拍 | 福利视频入口 | 精品免费视频123区 午夜久久成人 | 日韩最新在线视频 | 天天干国产 | 亚洲欧美成aⅴ人在线观看 四虎在线观看 | 国产日产精品一区二区三区四区 | 国产香蕉视频在线播放 | 丁香五月亚洲综合在线 | 国产精品 国产精品 | 国产+日韩欧美 | 99热在线国产精品 | 一级片在线 | 免费av一级电影 | 久 久久影院 | 国产精品美女久久久久久久 | 国产伦理精品一区二区 | 欧美少妇xxxxxx | av在线播放亚洲 |