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

网站现状分析古镇做灯饰网站的公司

网站现状分析,古镇做灯饰网站的公司,厦门电商网站开发,服务器怎么租用文章目录 数据结构和算法#xff0c;单链表的实现(kotlin版)b站视频链接1.定义接口#xff0c;我们需要实现的方法2.定义节点#xff0c;表示每个链表节点。3.push(e: E)#xff0c;链表尾部新增一个节点4.size(): Int#xff0c;返回链表的长度5.getValue(index: Int): E… 文章目录 数据结构和算法单链表的实现(kotlin版)b站视频链接1.定义接口我们需要实现的方法2.定义节点表示每个链表节点。3.push(e: E)链表尾部新增一个节点4.size(): Int返回链表的长度5.getValue(index: Int): E?获取列表的value值6.insert(index: Int,e: E)从任意位置插入一个节点7.remove(index: Int)任意位置删除一个节点8.完整Demo 数据结构和算法单链表的实现(kotlin版) b站视频链接 单链表的实现–koltin版本 1.定义接口我们需要实现的方法 interface LinkedListActionE {fun push(e: E)fun size(): Intfun getValue(index: Int): E?fun insert(index: Int,e: E)fun remove(index: Int) }2.定义节点表示每个链表节点。 data class NodeE(var next: NodeE? null, var value: E)3.push(e: E)链表尾部新增一个节点 override fun push(e: E) {val newNode Node(null, e)if (head ! null) { // val lastNode node(len - 1)//O1时间复杂度last?.next newNode} else {head newNode}last newNodelen}4.size(): Int返回链表的长度 override fun size(): Int {return len}5.getValue(index: Int): E?获取列表的value值 override fun getValue(index: Int): E? {if (index 0 || index len) {throw ArrayIndexOutOfBoundsException(数组越界.....)}return node(index)?.value}//找到对应index下标的节点。private fun node(index: Int): NodeE? {var h head//On时间复杂度for (i in 0 until index) {h h?.next}return h}6.insert(index: Int,e: E)从任意位置插入一个节点 override fun insert(index: Int, e: E) {val newNode Node(null, e)//考虑边界if (index 0) {val h headhead newNodenewNode.next h} else {//考虑最后一个位置val prev node(index - 1)val next prev?.nextprev?.next newNodenewNode.next next}len}//找到对应index下标的节点。private fun node(index: Int): NodeE? {var h head//On时间复杂度for (i in 0 until index) {h h?.next}return h}7.remove(index: Int)任意位置删除一个节点 override fun remove(index: Int) {if (index 0 || index len) {throw ArrayIndexOutOfBoundsException(数组越界.....)}if (index 0) {val h headhead h?.nexth?.next null} else {val prev node(index - 1)val current prev?.nextprev?.next current?.nextcurrent?.next null}len--}//找到对应index下标的节点。private fun node(index: Int): NodeE? {var h head//On时间复杂度for (i in 0 until index) {h h?.next}return h}8.完整Demo package day1class LinkedListE : LinkedListActionE {//头指针private var head: NodeE? null//优化时间复杂度private var last: NodeE? null//集合的长度private var len 0override fun push(e: E) {val newNode Node(null, e)if (head ! null) { // val lastNode node(len - 1)//O1时间复杂度last?.next newNode} else {head newNode}last newNodelen}//找到对应index下标的节点。private fun node(index: Int): NodeE? {var h head//On时间复杂度for (i in 0 until index) {h h?.next}return h}override fun size(): Int {return len}override fun getValue(index: Int): E? {if (index 0 || index len) {throw ArrayIndexOutOfBoundsException(数组越界.....)}return node(index)?.value}override fun insert(index: Int, e: E) {val newNode Node(null, e)//考虑边界if (index 0) {val h headhead newNodenewNode.next h} else {//考虑最后一个位置val prev node(index - 1)val next prev?.nextprev?.next newNodenewNode.next next}len}override fun remove(index: Int) {if (index 0 || index len) {throw ArrayIndexOutOfBoundsException(数组越界.....)}if (index 0) {val h headhead h?.nexth?.next null} else {val prev node(index - 1)val current prev?.nextprev?.next current?.nextcurrent?.next null}len--}}
http://www.yingshimen.cn/news/96842/

相关文章:

  • 建设银行江西分行官方网站iis网站怎么做全站伪静态
  • 陇南建设网站海尔电子商务网站建设
  • 用.net做网站好 还是用php网站seo推广哪家值得信赖
  • 网站开发年薪旅游网站首页制作
  • sql可以做网站吗软件开发定制价格表
  • xps13适合网站开发吗wordpress加logo
  • 邢台网站建设哪儿好网站建设游戏公司
  • 网页升级访问站wordpress七牛缩略图
  • 可以做装修效果图的网站有哪些购物网站页面设计步骤
  • 江苏省住房建设厅网站首页创意网页设计题库
  • 网站制作设计专业公司电子商务网站和普通网站的区别
  • 深圳网站制作公司深圳app开发微信服务号功能开发
  • 注册公司在哪个网站windows没有wordpress
  • 做淘宝客网站php如何不要钱做网站
  • 秦皇岛企业建网站吉林做网站优化
  • 长春火车站属于哪个区全案营销策划
  • 网站建设费如何入账怎么摊销手机网站 生成
  • 娱乐平台网站建设网站面板
  • 汝南企业网站建设wordpress过滤评论插件
  • 微网站开发教材数据分析网站html模板下载
  • 铜陵县住房和城乡建设局网站成品动漫和视频网站入口
  • 海外网站购物平台有哪些cakephp网站开发框架
  • 招聘网站建设需求分析美工培训班
  • 制作网页网站小说教程哪个网站做外贸生意
  • 广州沙河一起做网站网站按条件显示广告图片
  • 手机网站设计立找亿企邦中国展陈公司前十名
  • 网站建设网站结构图wordpress商店安装
  • 爱站seo工具wordpress口腔主题
  • 网站开发logo做网站都要掌握什么软件
  • 珠海十大网站建设公司排名华为公司网站建设方案模板