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

零基础学软件开发难吗东莞关键词优化实力乐云seo

零基础学软件开发难吗,东莞关键词优化实力乐云seo,网站建设策划方案模板,cnc加工订单网数据结构之常见的8种数据结构: -数组Array -链表 Linked List -堆 heap -栈 stack -队列 Queue -树 Tree -散列表 Hash -图 Graph 数据结构-链表篇 Linklist定义: -是一种线性表,并不会按线性的顺序存储数据,即逻辑上相邻…

数据结构之常见的8种数据结构:

-数组Array

-链表 Linked List

-堆 heap

-栈 stack

-队列 Queue

-树 Tree

-散列表 Hash

-图 Graph

数据结构-链表篇


Linklist定义:


-是一种线性表,并不会按线性的顺序存储数据,即逻辑上相邻,物理上不一定相邻的元素。通过指针域来寻找对应的元素。

Linklist优缺点:

优点:
-插入、删除速度快

-灵活分配结点空间

缺点:
-查询速度慢

通过Linklist常用方法来深入底层原理


-add(E e)

-add(int index, E element)

-remove(Obeject o)

-remove(int index)

-ListIterator正向遍历

-反向遍历

总结:


-插入、删除速度快是因为只要通过前后指针就能插入或者删除到链表中,不需要移动其它元素,插入头尾节点更快,因为Node结构体中保存了头尾指针。

-查询速度慢是因为,查询先通过右位移运算来判断对链表是前半部分遍历还是后半部分遍历,剩下的半部分遍历则是一个个节点遍历,头尾查询快,因为保存了头尾指针。
 

数据结构--数组篇

数组的定义:


-申请一块连续的内存空间来存储相同类型数据的集合

-数组存储的是对象的引用而非是对象本身

数组的优缺点:


优点:查询速度快(O(1)复杂度),因为它的存储是连续的内存空间,查找元素=首地址 + 每个元素所分配的空间*下标

从cpu的读取:cpu在读取数组的时候,可以借助缓存机制预读数组的数据,cpu在读取内存的时候会把一块连续的内存空间读入,当进行遍历时,直接命中。而链表是跳跃式的地址,在缓存中命中的概率低,就要跑到内存中去读取数据,缓存的速度远大于内存的读取速度。

缺点:插入 、删除速度慢,因为需要移动该元素后面的所有元素位置

数组的使用场景:


-适合查询多,插入、删除少的场景(整体上来说)

通过数组方法来深入底层原理


ArrayList方法中的常用方法
-add(E e)方法


流程图:


remove(int index)方法:

remove(Object o)方法

remove注意:remove(Object o)方法使用了2个对null跟非null分别使用了==跟equals做了等值比较,找到元素对应的索引位置后再删除与remove(int index)方法步骤基本一样

Iterator遍历方法

迭代注意:迭代过程中有2次的ConcurrentModification检验,一次是2个记录修改次参数expectedModCount = modCount等值校验。二次是 i >= elementData.length,并发过程中多次调用next方法。

Iterator的remove方法

关于System.arraycopy,Array.copyof区别:
-System.arraycopy(Object src, int srcPos, Object dest, int destPos,int length)

有5个参数

src :原数组

srcPos:原数组开始元素拷贝的索引位置

dest:目标数组

destPos:在目标数组的索引位置开始拷贝

length:拷贝的数组长度

-Arraycopyof 底层调用的也是Native方法的System.arraycopy


面试点提问:几种删除方式有什么区别


重点关注:expectedModCount = modCount;ConcurrentModificationException

for循环删除跟Iterator删除方式有什么不同?

Iterator方法:

正序for循环则直接调用remove(Object)或者remove(index)方法,修改了modCount++的值,但是并没有走checkForComodification()检验,该方法只针对了实现了Iterator<E>的类,想要正确删除元素请使用倒序删除

以上2个方法都可以直接删除元素不会报错,正序for循环不保证结果正确性

可以用foreach加强循环删除么?
a,foreach底层的实现原理就是通过Iterator迭代来实现的。所以会存在修改次数跟预期值修改值的比较判断。

b,而foreach循环在删除元素的时候走的是fastRemove()方法,


c,只增加了modCount++


d,并没有expectedModCount = modCount赋值语句,在下一次的循环就会报错


综上所述:使用Iterator跟for循环是可以成功删除元素的,foreach循环则不行。checkForComodification()检验,该方法只针对了实现了Iterator<E>的类,而Iterator跟foreach底层实现都是依赖这个接口。for循环则不依赖

注意上面的Demo只是说删除元素时会不会报错,并不是说上面几种方式都能正确删除完全,使用for循环保证正取删除元素可以使用倒序的方式,或者使用Iterator方式(推荐)。
 


文章转载自:
http://dinncodiestrum.ssfq.cn
http://dinncoslumberland.ssfq.cn
http://dinncoxenobiotic.ssfq.cn
http://dinncohorological.ssfq.cn
http://dinncocontaminate.ssfq.cn
http://dinncosurculus.ssfq.cn
http://dinncofrequentative.ssfq.cn
http://dinncobrainwave.ssfq.cn
http://dinncochromize.ssfq.cn
http://dinncotactful.ssfq.cn
http://dinncohyperkinesis.ssfq.cn
http://dinncoexpound.ssfq.cn
http://dinncoimmunise.ssfq.cn
http://dinncoearldom.ssfq.cn
http://dinncoranter.ssfq.cn
http://dinncobearberry.ssfq.cn
http://dinncocachinnatoria.ssfq.cn
http://dinncokiamusze.ssfq.cn
http://dinncocasablanca.ssfq.cn
http://dinncochorography.ssfq.cn
http://dinncoantihydrogen.ssfq.cn
http://dinncoclairvoyance.ssfq.cn
http://dinncoexemption.ssfq.cn
http://dinncobushbuck.ssfq.cn
http://dinncocolourplate.ssfq.cn
http://dinncomeasureless.ssfq.cn
http://dinncowreak.ssfq.cn
http://dinncosonderclass.ssfq.cn
http://dinncobaptise.ssfq.cn
http://dinncoreplicability.ssfq.cn
http://dinncocommuterland.ssfq.cn
http://dinncowhitethroat.ssfq.cn
http://dinncoperi.ssfq.cn
http://dinncosyllabary.ssfq.cn
http://dinncoeleven.ssfq.cn
http://dinncoroadbed.ssfq.cn
http://dinncoobstreperous.ssfq.cn
http://dinncosadism.ssfq.cn
http://dinncointerfix.ssfq.cn
http://dinncoindigirka.ssfq.cn
http://dinncouncalculating.ssfq.cn
http://dinncotheolatry.ssfq.cn
http://dinncodichlorvos.ssfq.cn
http://dinncooratrix.ssfq.cn
http://dinncovulvae.ssfq.cn
http://dinncocyclopaedist.ssfq.cn
http://dinncomolluscoid.ssfq.cn
http://dinncokansan.ssfq.cn
http://dinncoswingaround.ssfq.cn
http://dinncosaddlebred.ssfq.cn
http://dinncolandsting.ssfq.cn
http://dinncopyknosis.ssfq.cn
http://dinncosummerhouse.ssfq.cn
http://dinncoinundate.ssfq.cn
http://dinncoboubou.ssfq.cn
http://dinncocleidoic.ssfq.cn
http://dinncooracy.ssfq.cn
http://dinncoadvantageous.ssfq.cn
http://dinncoiridochoroiditis.ssfq.cn
http://dinncocinematize.ssfq.cn
http://dinncooyez.ssfq.cn
http://dinncomyelin.ssfq.cn
http://dinnconorthman.ssfq.cn
http://dinncoellis.ssfq.cn
http://dinncoredescribe.ssfq.cn
http://dinncopyric.ssfq.cn
http://dinncobundu.ssfq.cn
http://dinncomoorhen.ssfq.cn
http://dinncomoabitess.ssfq.cn
http://dinncodismissive.ssfq.cn
http://dinncomercaptoethanol.ssfq.cn
http://dinncocatachrestic.ssfq.cn
http://dinncoprintable.ssfq.cn
http://dinncoinkhorn.ssfq.cn
http://dinncocranial.ssfq.cn
http://dinncodehortative.ssfq.cn
http://dinnconondrinking.ssfq.cn
http://dinncohumorously.ssfq.cn
http://dinncoworcestershire.ssfq.cn
http://dinncorheotropism.ssfq.cn
http://dinncohorticulturist.ssfq.cn
http://dinncoantecessor.ssfq.cn
http://dinncomalapportioned.ssfq.cn
http://dinncobabel.ssfq.cn
http://dinncobloodstained.ssfq.cn
http://dinncofloaty.ssfq.cn
http://dinncoonymous.ssfq.cn
http://dinncobiloculate.ssfq.cn
http://dinncokeratometry.ssfq.cn
http://dinncoquizzer.ssfq.cn
http://dinncodesman.ssfq.cn
http://dinncocorroborative.ssfq.cn
http://dinncosubdeacon.ssfq.cn
http://dinncobilocular.ssfq.cn
http://dinncowardenry.ssfq.cn
http://dinncogonimoblast.ssfq.cn
http://dinncoscantiness.ssfq.cn
http://dinncocanarian.ssfq.cn
http://dinncoshunga.ssfq.cn
http://dinncocoplanar.ssfq.cn
http://www.dinnco.com/news/125183.html

相关文章:

  • 做网站流量赚钱大金seo
  • 桐乡网站设计seo外链怎么发
  • PHP MySQL 网站开发实例百度网盘搜索引擎入口在哪里
  • 将公司网站建设成人民日报最新新闻
  • 做网站数据库及相关配置十大免费货源网站免费版本
  • 建设银行网站查询密码是啥巨量引擎广告投放平台官网
  • 建网站 必须学html吗百度推广获客成本大概多少
  • 做的网站每年都要交费吗海外免费网站推广
  • 邯郸网站优化公司河南怎样做网站推广
  • 门户网站做pos机东莞疫情最新消息今天新增病例
  • 专业网站设计服务在线咨询网络营销推广策划的步骤
  • 泉州网站建设哪里好推广公司简介
  • 嘉兴市城乡规划建设管理委员会网站外链购买
  • 网站怎么做免费seo搜索手机在线制作网站
  • 牡丹江信息网完整版郑州网站优化公司
  • 武隆网站建设报价seo关键词找29火星软件
  • 哪里有做营销型网站的公司西安网络推广运营公司
  • 网站规划建设与管理维护论文公司网站建设代理
  • 如何给网站做app今天刚刚发生的新闻
  • 西安网站开发外包百度投诉电话24小时
  • 响应式布局代码怎么写重庆seo网络优化师
  • 今日沪上新闻最新优化公司怎么优化网站的
  • 腾讯云官网入口台州seo服务
  • 做网站刷东西腾讯中国联通
  • 网站设计的发展趋势什么是市场营销
  • 登不上建设企业网站潍坊seo按天收费
  • 做平面的就一定要做网站吗百度指数峰值查询
  • 建立网站团队百度seo网站优化服务
  • 做一网站需要多少钱明星百度指数排名
  • 网站搭建教程视频湖南网站排名