商家自己做的商品信息查询网站网站开发结论

news/2025/9/22 18:26:20/文章来源:
商家自己做的商品信息查询网站,网站开发结论,计算机网络技术毕业设计选题,广药网站建设试卷本文实例讲述了PHP双向链表定义与用法。分享给大家供大家参考#xff0c;具体如下#xff1a;由于需要对一组数据多次进行移动操作#xff0c;所以写个双向链表。但对php实在不熟悉#xff0c;虽然测试各个方法没啥问题#xff0c;就是不知道php语言深层的这些指针和unset…本文实例讲述了PHP双向链表定义与用法。分享给大家供大家参考具体如下由于需要对一组数据多次进行移动操作所以写个双向链表。但对php实在不熟悉虽然测试各个方法没啥问题就是不知道php语言深层的这些指针和unset有什么注意的地方贴出来让大家教育吧。效率没测试....求谅解/*** **双向链表* author zhiyuan12*//*** 链表元素结点类*/class Node_Element {public $pre NULL; // 前驱public $next NULL; // 后继public $key NULL; // 元素键值public $data NULL; // 结点值function __Construct($key, $data) {$this-key $key;$this-data $data;}}/*** 双向链表类*/class DoubleLinkedList {private $head; // 头指针private $tail; // 尾指针private $current; // 当前指针private $len; // 链表长度function __Construct() {$this-head self::_getNode ( null, null );$this-curelement $this-head;$this-tail $this-head;$len 0;}/*** desc: 读取链表全部结点*/public function readAll() {$tmp $this-head;while ( $tmp-next ! null ) {$tmp $tmp-next;var_dump ( $tmp-key, $tmp-data );}}public function move($pos1, $pos2) {$pos1Node $this-findPosition ( $pos1 );$pos2Node $this-findPosition ( $pos2 );if ($pos1Node ! null $pos2Node ! null) {$tmpKey $pos1Node-key;$tmpData $pos1Node-data;$pos1Node-key $pos2Node-key;$pos1Node-data $pos2Node-data;$pos2Node-key $tmpKey;$pos2Node-data $tmpData;return true;}return false;}/*** desc: 在指定关键词删除结点** param : $key* 指定位置的链表元素key*/public function delete($key) {$pos $this-find ( $key );if ($pos ! null) {$tmp $pos;$last null;$first true;while ( $tmp-next ! null $tmp-next-key $key ) {$tmp $tmp-next;if (! $first) {$this-delNode ( $last );} else {$first false;}$last $tmp;}if ($tmp-next ! null) {$pos-pre-next $tmp-next;$tmp-next-pre $pos-pre;} else {$pos-pre-next null;}$this-delNode ( $pos );$this-delNode ( $tmp );}}/*** desc: 在指定位置删除结点** param : $key* 指定位置的链表元素key*/public function deletePosition($pos) {$tmp $this-findPosition ( $pos );if ($tmp null) {return true;}if ($tmp $this-getTail ()) {$tmp-pre-next null;$this-delNode ( $tmp );return true;}$tmp-pre-next $tmp-next;$tmp-next-pre $tmp-pre;$this-delNode ( $tmp );}/*** desc: 在指定键值之前插入结点** param : $key* //指定位置的链表元素key* param : $data* //要插入的链表元素数据* param : $flag* //是否顺序查找位置进行插入*/public function insert($key, $data, $flag true) {$newNode self::_getNode ( $key, $data );$tmp $this-find ( $key, $flag );if ($tmp ! null) {$newNode-pre $tmp-pre;$newNode-next $tmp;$tmp-pre $newNode;$newNode-pre-next $newNode;} else {$newNode-pre $this-tail;$this-tail-next $newNode;$this-tail $newNode;}$this-len ;}/*** desc: 在指定位置之前插入结点** param : $pos* 指定插入链表的位置* param : $key* 指定位置的链表元素key* param : $data* 要插入的链表元素数据*/public function insertPosition($pos, $key, $data) {$newNode self::_getNode ( $key, $data );$tmp $this-findPosition ( $pos );if ($tmp ! null) {$newNode-pre $tmp-pre;$newNode-next $tmp;$tmp-pre $newNode;$newNode-pre-next $newNode;} else {$newNode-pre $this-tail;$this-tail-next $newNode;$this-tail $newNode;}$this-len ;return true;}/*** desc: 根据key值查询指定位置数据** param : $key* //指定位置的链表元素key* param : $flag* //是否顺序查找*/public function find($key, $flag true) {if ($flag) {$tmp $this-head;while ( $tmp-next ! null ) {$tmp $tmp-next;if ($tmp-key $key) {return $tmp;}}} else {$tmp $this-getTail ();while ( $tmp-pre ! null ) {if ($tmp-key $key) {return $tmp;}$tmp $tmp-pre;}}return null;}/*** desc: 根据位置查询指定位置数据** param : $pos* //指定位置的链表元素key*/public function findPosition($pos) {if ($pos 0 || $pos $this-len)return null;if ($pos ($this-len / 2 1)) {$tmp $this-head;$count 0;while ( $tmp-next ! null ) {$tmp $tmp-next;$count ;if ($count $pos) {return $tmp;}}} else {$tmp $this-tail;$pos $this-len - $pos 1;$count 1;while ( $tmp-pre ! null ) {if ($count $pos) {return $tmp;}$tmp $tmp-pre;$count ;}}return null;}/*** desc: 返回链表头节点*/public function getHead() {return $this-head-next;}/*** desc: 返回链表尾节点*/public function getTail() {return $this-tail;}/*** desc: 查询链表节点个数*/public function getLength() {return $this-len;}private static function _getNode($key, $data) {$newNode new Node_Element ( $key, $data );if ($newNode null) {echo new node fail!;}return $newNode;}private function delNode($node) {unset ( $node );$this-len --;}}$myList new DoubleLinkedList ();$myList-insert ( 1, test1 );$myList-insert ( 2, test2 );$myList-insert ( 2b, test2-b );$myList-insert ( 2, test2-c );$myList-insert ( 3, test3 );$myList-insertPosition ( 5, t, testt );$myList-readAll ();echo ;$myList-deletePosition(0);$myList-readAll ();echo ... . $myList-getLength ();var_dump ( $myList-findPosition ( 3 )-data );?运行结果int(1)string(5) test1int(2)string(7) test2-cint(2)string(5) test2string(2) 2bstring(7) test2-bstring(1) tstring(5) testtint(3)string(5) test3int(1)string(5) test1int(2)string(7) test2-cint(2)string(5) test2string(2) 2bstring(7) test2-bstring(1) tstring(5) testtint(3)string(5) test3...6string(5) test2希望本文所述对大家PHP程序设计有所帮助。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/909967.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

漯河市万金镇网站建设建设个人网站用到的技术

matlab语言丰富的图形表现方法,使得数学计算结果可以方便地、多样性地实现了可视化,这是其它语言所不能比拟的。;第一节 符号函数绘图第二节 图形编辑第三节 2D数据图第四节 3D数据图第五节 MATLAB的视图功能第六节 图像、视频和声音;plot —— 最基本的…

嘉兴品牌网站初学者求教怎样做网站

序言 Sentinel 是阿里巴巴开源的一款流量防护与监控平台,它可以帮助开发者有效地管理微服务的流量,实现流量控制、熔断降级、系统负载保护等功能。本文将介绍如何在项目中部署和配置 Sentinel 控制台,实现微服务的流量防护和监控。 一、Sen…

深圳网站开发的公司网站建设与管理案例...

智能优化算法应用:基于适应度相关算法3D无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用:基于适应度相关算法3D无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.适应度相关算法4.实验参数设定5.算法…

长春做网站公司企业名录搜索软件 2022

上一篇文章已经介绍了线程的基本概念以及线程相关的API,下面来看一下线程池 一、线程池框架 1、线程池的优点 重用线程池中的线程,避免因为线程的创建和销毁所带来的性能开销。 能有效控制线程池的最大并发数,避免大量线程之间因互相抢夺系…

可以登录国外网站吗宿州城乡建设局网站

转载自 JAVA面试常考系列三 题目一 什么是迭代器(Iterator)? 迭代器(iterator)是一种对象,它能够用来遍历标准模板库容器中的部分或全部元素,每个迭代器对象代表容器中确定的地址。迭代器提供了一种方法,可…

网站建设三个友好网络营销理论包括哪些

我不知道正确的方法,但是这种手动方法是我用于简单脚本的方法,似乎已经适当地执行了。我会假设我所在的任何目录,我的程序的Python文件都在相对的src /目录中,我要执行的文件(具有正确的shebang和执行权限)被命名为main.py。$ mkd…

火速收藏!2025 云栖大会 AI 中间件议程看点全公开(附免费报名通道)

AI 正在重塑世界,也在颠覆其应用的构建范式 AI 中间件正成为连接 AI 技术与产业应用的纽带 2025 云栖大会“云智一体 碳硅共生”的主题下 9月26日,云栖小镇D1-3馆「AI 中间件论坛」 将聚焦 AI 时代中间件的技术演进…

Flutter跨平台工程实践与原理透视:从渲染引擎到高质产物 - 指南

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

第二次软工作业——个人项目 - LXJ

github仓库:https://github.com/ApplePI-xu/3123004185这个作业属于哪个课程 https://edu.cnblogs.com/campus/gdgy/Class12Grade23ComputerScience这个作业要求在哪里 https://edu.cnblogs.com/campus/gdgy/Class12G…

WinForm引入项目资源文件

以Buttom按钮为例去引入 ,在Debug文件目录下 , 新建一个images文件夹 ,然后把要使用的资源(图片)拖进去 ​将资源加载到项目中去 ,点击 Properties下面的Resoures.resx , 然后把图片直接拖进去 效果如下: ​这个…

猪八戒做网站排名网页设计制作教程

消息队列在使用过程中会出现很多问题 首先就是消息的可靠性,也就是消息从发送到消费者接收,消息在这中间过程中可能会丢失 生产者到交换机的过程、交换机到队列的过程、消息队列中、消费者接收消息的过程中,这些过程中消息都可能会丢失。 …

境外社交网站上做推广手机排名

一、准备两台主机,区分主从 二、完全区域传送 1、主DNS服务器配置 #安装相关的包 [rootoula1 ~]# yum install bind -y#关闭防火墙 [rootoula1 ~]# systemctl stop firewalld [rootoula1 ~]# setenforce 0#修改配置主文件 [rootoula1 ~]# vim /etc/named.conf opt…

广州百度网站推广设计网站app

WFilter NGF的“Web认证”模块,提供了一系列的上网认证解决方案。包括如下认证方式:本地用户名密码认证AD域用户名密码认证企业邮箱用户名密码认证Radius用户名密码认证微信WiFi认证Facebook Wifi认证除此,WFilter NGF还有一个“其他”的选项…

政务网站建设 发言山东省中国建设银行网站

精华置顶 墙裂推荐!小白如何1个月系统学习CV核心知识:链接 点击CV计算机视觉,关注更多CV干货 论文已打包,点击进入—>下载界面 点击加入—>CV计算机视觉交流群 1.【目标检测】Re-Scoring Using Image-Language Similarit…

建设部网站官网造价系统广州网站设计哪里好

概念 发生在使用模板引擎解析用户提供的输入时。模板注入漏洞可能导致攻击者能够执行恶意代码或访问未授权的数据。 模板引擎可以让(网站)程序实现界面与数据分离,业务代码与逻辑代码分离。即也拓宽了攻击面,注入到模板中的代码可…

网站服务器维护内容php网站里放asp

在云计算和数据中心领域,Linux虚拟化作为基础设施的核心组件,为资源的高效利用和应用程序的灵活部署提供了坚实的基础。然而,尽管其优势显著,虚拟化环境下的性能损失问题仍然是一个不可忽视的挑战。本文将深入探讨Linux虚拟化中性…

中文网站域名外国网站做vr

Linux、Docker、Brew、Nginx常用命令 Linuxvi编辑器文件操作文件夹操作磁盘操作 DockerBrewNginx参考 Linux vi编辑器 Vi有三种模式。命令模式、输入模式、尾行模式,简单的关系如下: i -- 切换到输入模式,在光标当前位置开始输入文本。&a…

淘宝网站开发费用关于建设工程招标的网站

昨天(11月17日)升级到Windows 10 Threshold 2版本。我的使用的设备是Surface Pro 3,4G内存,128G硬盘。 Threshold 2是作为一个Windows系统更新推送的。如果没有收到系统更新提示,在系统设置里面手动检查一下更新就可以…

网站制作珠海公司asp.net 发布网站 ftp

1、类型转换构造 |自定义转换 利用一个已定义的对象,来定义另一个不同类型的对象 实现从源类型到目标类型的隐式类型转换的目的 总结下已知构造,包括类型转换构造 如下,如果Person给Human赋值时,Person有私有变量,则需要在Pers…