数据结构代码

Posted keiko

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据结构代码相关的知识,希望对你有一定的参考价值。

a是数据结构的:栈

const a = []
a.push (1)
a.push (2)
a.push (3)
const item = a.pop()

a是数据结构的:队列

const a = []
a.push (1)
a.push (2)
a.push (3)
const item = a.shift()

a最接近哪种数据结构:哈希表

const a = {
  name:"frank",
  age:18
}

a最接近哪种数据结构:链表

const a = {
  value:1,
  next:{
    value:2,
    next:{
       value:3,
       next:null
     }
   }
}

a最接近哪种数据结构:树

const a = {
  value:1,
  children:[{value:2,children:null},{value:3,children:[{value:4,children:null}]
  }]
}

以上是关于数据结构代码的主要内容,如果未能解决你的问题,请参考以下文章