中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

企業(yè)建站技術(shù)軟文營銷名詞解釋

企業(yè)建站技術(shù),軟文營銷名詞解釋,安全可靠網(wǎng)站認(rèn)證,wordpress無法打開 404鏈表的定義,相信大家都知道,這里就不贅述了只是鏈表分單向鏈表和雙向鏈表,廢話不多說,直接上代碼 鏈表節(jié)點的定義: public class Node {int val;Node next;Node pre;public Node(int val, Node next, Node pre) {thi…

鏈表的定義,相信大家都知道,這里就不贅述了只是鏈表分單向鏈表和雙向鏈表,廢話不多說,直接上代碼

鏈表節(jié)點的定義:

public class Node {int val;Node next;Node pre;public Node(int val, Node next, Node pre) {this.val = val;this.next = next;this.pre = pre;}public Node(int val, Node next) {this.val = val;this.next = next;}public Node(int val) {this.val = val;}public Node() {}
}

打印鏈表的兩種方式:

    //從前往后打印鏈表private void print(Node head) {while (head != null) {System.err.print(head.val);head = head.next;}System.err.println();}//從后往前打印鏈表private void print1(Node head) {while (head != null) {System.err.print(head.val);head = head.pre;}System.err.println();}

翻轉(zhuǎn)單向鏈表:核心思路是先斷開連接,再將next指向前繼節(jié)點,為了避免斷開之后,找不到前繼節(jié)點,需要用一個臨時變量記錄前繼節(jié)點,在下一輪循環(huán)的時候把當(dāng)前節(jié)點的next指向上一輪循環(huán)時的pre

    //翻轉(zhuǎn)單鏈表private Node reverList(Node head) {Node pre = null;Node next = null;while (head != null) {//下一次進(jìn)來的時候連上前一個節(jié)點,先記錄下前一個節(jié)點,不能先斷開了后面的節(jié)點,不然就找不到了next = head.next;head.next = pre;pre = head;head = next;}return pre;}@Testpublic void reverList() {Node one = new Node(2, new Node(3, new Node(4)));print(one);print(reverList(one));}

翻轉(zhuǎn)雙向鏈表:思路同單向鏈表一樣,只是多了一些判斷

   //翻轉(zhuǎn)雙向鏈表private Node reverseDoubleList(Node head) {Node next = null;Node pre = null;while (head != null) {next = head.next;head.next = pre;head.pre = next;pre = head;head = next;}return pre;}@Testpublic void reverseDoubleList() {Node one = new Node(1);Node two = new Node(2);Node three = new Node(3);one.next = two;one.pre = null;two.next = three;two.pre = one;three.pre = two;three.next = null;print(one);print1(three);Node node = reverseDoubleList(one);print(node);print1(one);}

從鏈表中刪除指定的數(shù)據(jù):

 //從單鏈表中刪除指定的數(shù)據(jù)private Node removeList(Node head, int target) {Node pre = null;Node next = null;while (head != null) {//第一輪循環(huán)找到新的頭結(jié)點,因為要刪除的數(shù)據(jù)可能是第一個也可能是最后一個next = head.next;if (target != head.val) {break;}head = next;}next = pre = head;//while (next != null) {if (target == next.val) {next = next.next;pre.next = next;//相等的時候提前把pre和下一個連起來,這樣下一個如果相等,只需要移動pre即可continue;}pre = next;//不相等的時候pre記錄前一個節(jié)點,等到下一輪如果相等時候就可以把pre和next連上了next = next.next;}return head;}@Testpublic void removeList() {Node one = new Node(2, new Node(5, new Node(2, new Node(3, new Node(2)))));print(one);print(removeList(one, 2));}

http://www.risenshineclean.com/news/48852.html

相關(guān)文章:

  • 辦網(wǎng)站租服務(wù)器東莞優(yōu)化排名公司
  • 哪個網(wǎng)站可以做身份核驗大地資源網(wǎng)在線觀看免費
  • 企業(yè)做網(wǎng)站建設(shè)百度一下瀏覽器
  • icp網(wǎng)站建設(shè)seo手機搜索快速排名
  • W做網(wǎng)站怎么建立自己的企業(yè)網(wǎng)站
  • 做的網(wǎng)站怎么放到域名模板網(wǎng)站如何建站
  • 購物商城網(wǎng)站建設(shè)電商網(wǎng)站建設(shè)開發(fā)
  • 黑龍江省建設(shè)造價協(xié)會網(wǎng)站在線網(wǎng)站seo診斷
  • 什么網(wǎng)站發(fā)布找做效果圖的電腦優(yōu)化是什么意思
  • wordpress的文件結(jié)構(gòu)百度刷seo關(guān)鍵詞排名
  • 網(wǎng)站建設(shè)行業(yè)數(shù)據(jù)seo推薦
  • 商洛免費做網(wǎng)站百度廣告聯(lián)系方式
  • 豐金網(wǎng)絡(luò) 做網(wǎng)站數(shù)字營銷網(wǎng)站
  • 怎么做培訓(xùn)班網(wǎng)站石家莊關(guān)鍵詞優(yōu)化軟件
  • 什么是網(wǎng)絡(luò)營銷包含哪些內(nèi)容全網(wǎng)營銷與seo
  • 清理網(wǎng)站數(shù)據(jù)庫源碼交易平臺
  • 南昌那個公司做網(wǎng)站好今日最新國際新聞頭條
  • 金昌網(wǎng)站seo合肥seo推廣培訓(xùn)班
  • 蘇州專業(yè)做網(wǎng)站公司有哪些小說推廣關(guān)鍵詞怎么弄
  • 做網(wǎng)站需要的照片網(wǎng)站建設(shè)公司哪個好呀
  • 建站公司 萬維科技外鏈交換平臺
  • 網(wǎng)站設(shè)置密碼百度網(wǎng)站域名注冊
  • 給企業(yè)做宣傳網(wǎng)站的好處百度上如何發(fā)廣告
  • 開發(fā)平臺游戲名詞解釋搜索引擎優(yōu)化
  • 貴陽疫情最新消息今天寧波seo排名優(yōu)化培訓(xùn)
  • 網(wǎng)站建設(shè)公司信息搜索引擎營銷的優(yōu)勢和劣勢
  • 織夢的手機端網(wǎng)站模板技能培訓(xùn)有哪些科目
  • 破解版下載大全免費下載seo優(yōu)化軟件有哪些
  • 湛江免費建站哪里有淘寶聯(lián)盟怎么推廣
  • 鄭州網(wǎng)站開發(fā)設(shè)計公司電話個人如何優(yōu)化網(wǎng)站有哪些方法