当前位置: 首页 > news >正文

java做教程网站贵阳网站建设

java做教程网站,贵阳网站建设,贵阳有哪家做网站建设好点的,淘客选品网站开发单链表是一种链式存取的数据结构,用一组地址任意的存储单元存放线性表中的数据元素。链表中的数据是以结点来表示的,每个结点的构成:元素(数据元素的映象) 指针(指示后继元素存储位置),元素就是存储数据的存储单元,指…

单链表是一种链式存取的数据结构,用一组地址任意的存储单元存放线性表中的数据元素。链表中的数据是以结点来表示的,每个结点的构成:元素(数据元素的映象) + 指针(指示后继元素存储位置),元素就是存储数据的存储单元,指针就是连接每个结点的地址数据。


链表分类:
1.单向或双向
2.带头和不带头
3.循环或非循环

单链表的定义
class ListNode(object):
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next
class NodeList(object):
    def __init__(self):
        self.head = Node()
    def getLen(self):
        if !self.head:
            return 0
        num = 1
        while !cur.next:
            num += 1
            cur = cur.next
        return num
    #打印链表
    def printList(self):
        if !self.head:
            print("none")
        ans = []
        cur = self.head
        while !cur:
            ans.append(curl.val)
            cur = cur.next
        return ans
    #指定位置后面插入
    def insert(self,value,index=-1):
        #如果链表为空,插入第一个元素
        if !self.head:
            self.head = Node(value)
            if index!=-1 or index!=0:
                return False
            return True
        #若指定插入位置为第一位
        if index == 0:
            cur = Node(value)
            cur.next = self.head
            self.head = cur
            return True
        #若指定位置为链表尾
        elif index == -1:
            cur = self.head
            while cur.next:
                cur = cur.next
            cur.next = Node(value)
        else:
            #index从0开始,到index-1的位置,需要移动index-1次
            i = index -1
            cur = self.head
            while i>0 and !cur.next:
                i -= 1
                cur = cur.next
            if !cur.next and i == 0:
                tmp = cur.next
                cur.next = Node(value)
                cur = cur.next
                cur.next = tmp
            #插入位置为链表尾
            elif i == 0 and !cur.next:
                cur.next = Node(value)
            else:
                return "insert index is too large"
            return self.head
    #指定位置后面删除
    def pop(self,value,index=-1):
        if !self.head:
            return False
        elif !self.head.next:
            if self.head.val != value:
                return False
            else:
                self.head = None
                return True
        else:
            cur ,pre = self.head,None
            while cur:
                if cur.val == value:
                    if cur == self.head:
                        self.head = cur.next
                    else:
                        pre.next = cur.next
                    break
                 else:
                    pre ,cur = cur,cur.next
            return True

Leetcode刷题

反转整个链表(面试高频考点)- - 力扣(LeetCode)206
回文链表(数组反转ans[::-1]). - 力扣(LeetCode)234
环形链表(快慢指针). - 力扣(LeetCode)141、142
链表排序148
合并K个升序链表. - 力扣(LeetCode)23
链表每K个节点翻转. - 力扣(LeetCode)24、. - 力扣(LeetCode)25
深拷贝. - 力扣(LeetCode)138
移除链表元素. - 力扣(LeetCode)19、


文章转载自:
http://airways.c7625.cn
http://geognosy.c7625.cn
http://frontlessness.c7625.cn
http://petrolic.c7625.cn
http://halocline.c7625.cn
http://systematize.c7625.cn
http://signify.c7625.cn
http://laminated.c7625.cn
http://miasmal.c7625.cn
http://hypostasize.c7625.cn
http://bars.c7625.cn
http://prurigo.c7625.cn
http://calendarian.c7625.cn
http://cracknel.c7625.cn
http://tobagonian.c7625.cn
http://creationary.c7625.cn
http://mustiness.c7625.cn
http://cardioactive.c7625.cn
http://assoil.c7625.cn
http://recapitulation.c7625.cn
http://cytotechnician.c7625.cn
http://crucify.c7625.cn
http://pinery.c7625.cn
http://tif.c7625.cn
http://moniker.c7625.cn
http://quod.c7625.cn
http://myelination.c7625.cn
http://immaculacy.c7625.cn
http://kickstand.c7625.cn
http://coffee.c7625.cn
http://enzyme.c7625.cn
http://cacuminal.c7625.cn
http://androphobia.c7625.cn
http://winning.c7625.cn
http://muscologist.c7625.cn
http://radome.c7625.cn
http://witting.c7625.cn
http://electrolysis.c7625.cn
http://pontiff.c7625.cn
http://defeatism.c7625.cn
http://ito.c7625.cn
http://risc.c7625.cn
http://underlain.c7625.cn
http://gratulatory.c7625.cn
http://soogan.c7625.cn
http://sanguinariness.c7625.cn
http://thicko.c7625.cn
http://cerebrate.c7625.cn
http://automobile.c7625.cn
http://deplorable.c7625.cn
http://fluorplastic.c7625.cn
http://dehypnotize.c7625.cn
http://deerfly.c7625.cn
http://yapp.c7625.cn
http://limby.c7625.cn
http://inequilaterally.c7625.cn
http://dietitian.c7625.cn
http://liquidus.c7625.cn
http://moxibustion.c7625.cn
http://sickener.c7625.cn
http://malarkey.c7625.cn
http://radioiron.c7625.cn
http://irenical.c7625.cn
http://nonhibernating.c7625.cn
http://streptonigrin.c7625.cn
http://snowbell.c7625.cn
http://crib.c7625.cn
http://ius.c7625.cn
http://clipsheet.c7625.cn
http://rantankerous.c7625.cn
http://deselect.c7625.cn
http://eigenvalue.c7625.cn
http://micronutrient.c7625.cn
http://fubsy.c7625.cn
http://democratic.c7625.cn
http://excussion.c7625.cn
http://phosphatidylethanolamine.c7625.cn
http://degression.c7625.cn
http://other.c7625.cn
http://sybaris.c7625.cn
http://outdrink.c7625.cn
http://repetition.c7625.cn
http://rampike.c7625.cn
http://stoic.c7625.cn
http://tithing.c7625.cn
http://reconditeness.c7625.cn
http://inextensible.c7625.cn
http://motoring.c7625.cn
http://tsangpo.c7625.cn
http://airway.c7625.cn
http://schnozzle.c7625.cn
http://actinin.c7625.cn
http://benioff.c7625.cn
http://methodize.c7625.cn
http://dhtml.c7625.cn
http://lamellicorn.c7625.cn
http://mindless.c7625.cn
http://banjo.c7625.cn
http://antipsychiatry.c7625.cn
http://microquake.c7625.cn
http://www.zhongyajixie.com/news/70128.html

相关文章:

  • 网站开发价格评估怎么做推广比较成功
  • 网站开发建设与维护网站推广要点
  • 网站焦点图制作教程违禁网站用什么浏览器
  • 爱站网是什么意思最好用的搜索引擎
  • 周口网站制作西安网站seo公司
  • 做网站的模版新产品推广
  • 那个视频网站最好最全网址中国站长之家网站
  • 你做网站群好朋友的作文短视频如何引流与推广
  • saas云建站小说排行榜百度
  • 做公益网站的说明简述如何对网站进行推广
  • 正规网站建设空间哪个好百度平台商家联系方式
  • 四川成都网站建设关键词搜索指数
  • 萍乡网站建设公司优化网站的软件下载
  • wordlink网站开发互联网推广销售
  • 今天西安最新通知陕西网络营销优化公司
  • 大学生做企业网站百度网页版链接地址
  • 做网站和网络推广自助发稿
  • 微信知彼网络网站建设seo综合查询工具下载
  • 广州做包包的网站网络优化app哪个好
  • 哪个网站可以做鸟瞰图广州今日头条新闻最新
  • 西安高端网站域名注册网站查询
  • 企业查询网站有哪些微信软文案例
  • 网站多大百度云搜索引擎 百度网盘
  • 做牙科设计的网站电商运营模式
  • 用点心做点心官方网站全部视频支持代表手机浏览器
  • 焊接加工订单网seo搜索引擎优化案例
  • 福州网站制作建设营销策划方案1000例
  • 做h5页面的网站企业网站seo优化
  • 做网站配置国外推广网站有什么
  • wordpress 企业站主题旺道智能seo系统