javascript数据结构5-链表2 存放点数据(x,y)
来源:互联网 发布:商标域名抢注案例 编辑:程序博客网 时间:2024/05/21 06:45
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body><script>function Node(element){ this.element=element; this.next=null;} function Point(x,y){ this.x=x; this.y=y; } function LList(){ this.head=new Node('head'); //this.head.next=this.head; this.find=find; this.insert=insert; this.display=display; this.remove=remove; this.findPrevious=findPrevious; } function display(){ var curr=this.head; while(!(curr.next==null)){ document.write(curr.next.element.x+'/'+curr.next.element.y); curr=curr.next; } return curr; } function find(item){ var currNode=this.head; while(!(currNode.element==item)){currNode=currNode.next; } return currNode;} function insert(newElement, item) { var newNode = new Node(newElement); var current = this.find(item); newNode.next = current.next; current.next = newNode;} function findPrevious(item){ var currNode=this.head; while(!(currNode.next==null)&&(currNode.next.element!=item)){ currNode=currNode.next; } return currNode; } function remove(item){ var prevNode=this.findPrevious(item); if((prevNode.next!=null)){ prevNode.next=prevNode.next.next; } } var p1=new Point(1,2); var p2=new Point(3,4); //document.write(p2.x); // console.log(p1); var points=new LList(); points.insert(p1,'head'); points.insert(p2,p1); points.display();</script></body></html>
0 0
- javascript数据结构5-链表2 存放点数据(x,y)
- 散乱点(无序)三维(x,y,z)数据的表示
- 实时捕捉鼠标x点y点
- (x&y)+((x^y)>>1)用法
- Javascript—获取元素ele的位置(x,y)
- 根据某点直角坐标(x,y)计算该点与原点连线跟y轴夹角
- 根据三个点(x1,y1)、(x2,y2)、(x3,y3),确定方程y=aX^2 + bX + c,带入X求得Y
- x+2*y+5*z = 100
- CCSprite setPosition(ccp(x,y)),锚点
- train_test_split(X, y, stratify=y)
- 不可表示的数[x/2] + y + x * y(英雄会)
- 利用MATLAB绘制隐函数f(x,y)=x^2 * sin(x+y^2)+y^2 * exp(x+y)+5 * cos(x^2+y)=0的曲线
- 不可表示的数[x/2] + y + x * y
- (x&y)+((x^y)>>1)(面试宝典)
- SDUT 1447 水题(y*y = x*x + n)
- ( (x&y) + ( (x^y)>>1 ) )是什么意思?what's up?
- 求(x-y+z)*2
- X-Y Problem(推荐)
- js中数组,对象 的相关操作
- javascript数据结构5-链表(包括循环链表 双向链表)
- 新浪天气api
- centos 6.5安装tomcat7
- SQL语句中count(1)count(*)count(字段)用法的区别
- javascript数据结构5-链表2 存放点数据(x,y)
- centos下在线安装配置mysql
- junit示例
- [Caffe]:关于filler type
- javascript数据结构6-字典 散列 集合
- CentOS7修改时区的正确姿势
- 7.Reverse Integer
- Android安装apk时报 INSTALL_FAILED_INSUFFICIENT_STORAGE 错误的解决方法
- javascript数据结构7-二叉搜索树(BST)