数据结构40-链表get实现

  //获取详情方法
            LinkList.prototype.get=function(position){
                if(position<0||position>=this.length) return null
                //获取对应的data
                var current=this.head
                var index=0
                while(index<position){
                    current=current.next
                }
                return current.data
            }

posted @ 2022-12-13 14:57  前端导师歌谣  阅读(25)  评论(0)    收藏  举报