您的位置:首页 > 房产 > 建筑 > 电子商务平台经营者的特点体现在_免费下载模板ppt_阿里巴巴数据分析官网_网站关键词优化技巧

电子商务平台经营者的特点体现在_免费下载模板ppt_阿里巴巴数据分析官网_网站关键词优化技巧

2025/5/4 15:29:46 来源:https://blog.csdn.net/2401_88780316/article/details/147538685  浏览:    关键词:电子商务平台经营者的特点体现在_免费下载模板ppt_阿里巴巴数据分析官网_网站关键词优化技巧
电子商务平台经营者的特点体现在_免费下载模板ppt_阿里巴巴数据分析官网_网站关键词优化技巧

1、栈与堆的演示

(1)网页视图

(2)代码

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>栈和堆演示</title><style>body {font-family: Arial, sans-serif;text-align: center;}.container {display: flex;justify-content: space-around;margin: 20px;}.stack, .heap {border: 2px solid #000;width: 150px;height: 300px;position: relative;}.stack div, .heap div {width: 100%;height: 30px;background: #4CAF50;margin: 2px 0;transition: all 0.3s ease;}.heap div {background: #2196F3;}</style>
</head>
<body><h1>栈和堆演示</h1><div class="container"><div class="stack" id="stack"><h2>栈</h2></div><div class="heap" id="heap"><h2>堆</h2></div></div><button onclick="pup1()">压栈</button><button onclick="pup2()">弹栈</button><button onclick="pup3()">分配堆</button><button onclick="pup4()">释放堆</button><script>let stack = [];let heap = [];function pup1() {const value = Math.floor(Math.random() * 100);stack.push(value);updateStackDisplay();}function pup2() {if (stack.length > 0) {stack.pop();updateStackDisplay();}}function allocateHeap() {const value = Math.floor(Math.random() * 100);heap.push(value);updateHeapDisplay();}function deallocateHeap() {if (heap.length > 0) {heap.pop();updateHeapDisplay();}}function updateStackDisplay() {const stackDiv = document.getElementById('stack');stackDiv.innerHTML = '<h2>栈</h2>';stack.forEach(item => {const div = document.createElement('div');div.innerText = item;stackDiv.appendChild(div);});}function updateHeapDisplay() {const heapDiv = document.getElementById('heap');heapDiv.innerHTML = '<h2>堆</h2>';heap.forEach(item => {const div = document.createElement('div');div.innerText = item;heapDiv.appendChild(div);});}</script>
</body>
</html>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com