不带头节点的单链表的实现完成Do not take the lead singlelinked list of nodes to complete
#包括< iostream。 ”
模板<
课堂环节
{
公共
T数据
链接下一个
链接const T信息链接<T> * nextvalue = null {
数据=信息
未来= nextvalue
}
链接const环节<T> * nextvalue = null {
未来= nextvalue
}
}
模板<
类lnklist
{
私人
链接* *头 *尾
链接<T> * SETPOS const int p
公共lnklist
~ lnklist
布尔是空的 //检查链表是否为空
清空 //将链表存储的内容清除成为空表
空白打印 int length //返回此链表的当前实际长度
布尔加const T值 / /在表尾添加一个元素价值表的长度增1插入const int p const T值 / /在位置P上插入一个元素价
值表的长度增1
为消除const int p //删除位置P上的元素表的长度减1布尔getValue const int p t值 / /返回位置P的元素值布尔率int & P const T值 / /查找值为价值的元素并返回第1次出现的位置
}
模板<
链接<T> * lnklist <T> SETPOS int i
{int计数= 0
链接
而P = null &计算< i
{
下一页
计数+
}
返回p
}
模板<lnklist <T> lnklist {头=尾=空
}
模板<lnklist <T> ~ lnklist {链接< * * TMP
当头 = NULL {
头=下一个
删除T MP
}
}
模板<
无效lnklist <T> print {
链接
而P = null
{cout << P ->数据<<”
下一页
}
}
模板<
布尔lnklist <T> 是空的 {如果头= NULL
返回true
}
模板<
无效lnklist <T> 明确{
链接< * =头 * T MP
而P = null
{
T MP = P
下一页
删除T MP
}
}
模板<
国际lnklist <T> 长度 {int计数= 0
链接
而P = NULL {
下一页
计数+
}
返回计数
}
模板<
布尔lnklist <T> 附加const T值{
链接< * > *
新建链接<值>zero) ;if (head = = null)head = tail = p;else
{tail - > next = p;
tail = p;
}return true;
}class template < t >bool lnklist < t >: : insert (const int i, const t value) {link < t > * p * q;if (i = = 0) {d = new link < t > (value, head) .head = q;if (tail = = null)tail = q;return true;
}if ( (p = setpos (i - 1) = = 0) {court < < "insertion point is illegal" < < endl;
return false;
}d = new link < t > (value, p - > next) .p - > next = q;if (p = = tail) and tail = q;return true;
}class template < t >bool lnklist < t >: : remove (const int i){link < t > * p * q;if (head = = 0) {court < < "no element to delete" < < endl;return false;
}
RAKsmart发布了9月份优惠促销活动,从9月1日~9月30日期间,爆款美国服务器每日限量抢购最低$30.62-$46/月起,洛杉矶/圣何塞/香港/日本站群大量补货特价销售,美国1-10Gbps大带宽不限流量服务器低价热卖等。RAKsmart是一家华人运营的国外主机商,提供的产品包括独立服务器租用和VPS等,可选数据中心包括美国加州圣何塞、洛杉矶、中国香港、韩国、日本、荷兰等国家和地区数据中心(...
已经有一段时间没有分享阿里云服务商的促销活动,主要原因在于他们以前的促销都仅限新用户,而且我们大部分人都已经有过账户基本上促销活动和我们无缘。即便老用户可选新产品购买,也是比较配置较高的,所以就懒得分享。这不看到有阿里云金秋活动,有不错的促销活动可以允许产品新购。即便我们是老用户,但是比如你没有购买过他们轻量服务器,也是可以享受优惠活动的。这次轻量服务器在金秋活动中力度折扣比较大,2G5M配置年付...
mineserver怎么样?mineserver是一家国人商家,主要提供香港CN2 KVM VPS、香港CMI KVM VPS、日本CN2 KVM VPS、洛杉矶cn2 gia端口转发等服务,之前介绍过几次,最近比较活跃。这家新推出了洛杉矶CN2 GIA VPS,512MB内存/20GB NVME/800GB流量/200Mbps/KVM,58元/季,并且进行了带宽升级,同时IP更改为美国IP。点击...