周总结<3>
经过了一周的学习,我们在html以及C语言方面又有的新的知识点的学习,包括计算机导论也学会了路由器的设置。
html |
鼠标事件 |
C |
二叉树的遍历代码 |
计算机导论 |
路由器的设置 |
Html案例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
function mouseIn()
{
document.bgColor="red";
}
function mouseOut()
{
document.bgColor="blue";
}
var x=0,y=0;
function move()
{
x=window.event.x;
y=window.event.y;
window.status="X: "+x+" "+"Y: "+y+" ";
}
document.onmousemove=move;
function keypree()
{
switch(window.event.keyCode)
{
case 119: document.bgColor="blue";
break;
case 97: document.bgColor="yellow";
break;
}
}
document.onkeypress=keypree;
</script>
<body bg>
<input type="button" value="改变背景颜色" onmousedown="mouseIn()" onmouseup="mouseOut()" />
</body>
</html>
C语言案例:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
typedef char DataType;
typedef struct Node{
DataType data;
struct Node *LChild, *RChild;
}*BiTree;
/*先序遍历*/
void PreOrder(BiTree root)
{
if ( root!=NULL )
{
printf("%c", root->data);//访问根结点
PreOrder(root->LChild) ;
PreOrder(root->RChild) ;
}
}
/*中序遍历*/
void InOrder(BiTree root)
{
if ( root!=NULL )
{
InOrder(root->LChild) ;
printf("%c", root->data);//访问根结点
InOrder(root->RChild) ;
}
}
/*后序遍历*/
void PostOrder(BiTree root)
{
if ( root!=NULL )
{
PostOrder(root->LChild) ;
PostOrder(root->RChild) ;
printf("%c", root->data);
}
}
int main(int argc, char* argv[])
{
printf("303 柳晓雅 遍历\n");
int i;
BiTree t[10];
t[1]=(BiTree)malloc(sizeof(*t[0]));
t[2]=(BiTree)malloc(sizeof(*t[0]));
t[1]->data='A';
t[2]->data='B';
for (i=3;i<=9;i++)
{
t[i]=(BiTree)malloc(sizeof(*t[0]));
t[i]->data='A'+i;
t[i]->RChild=NULL;
t[i]->LChild=NULL;
}
t[1]->LChild=t[2]; t[1]->RChild=t[3];
t[2]->LChild=t[4]; t[2]->RChild=t[5];
t[5]->LChild=t[8]; t[5]->RChild=t[9];
t[3]->LChild=t[6]; t[3]->RChild=t[7];
printf("先序遍历:");
PreOrder(t[1]);
printf("\n");
printf("中序遍历:");
InOrder(t[1]);
printf("\n");
printf("后序遍历:");
PostOrder(t[1]);
printf("\n");
return 0;
}
最新文章
- BZOJ4553: [Tjoi2016&;Heoi2016]序列
- zk回车事件
- Python 通过print将数据保存到文件中
- 整理mysql的一些常用用法
- altKey,ctrlKey,shiftKey
- mysql用户权限管理
- Kafka,Mq,Redis作为消息队列使用时的差异?
- Python爬虫入门教程 24-100 微医挂号网医生数据抓取
- JavaScript对象(第四天)
- vue 中 直接操作 cookie 及 如何使用工具 js-cookie
- Segment 李超线段树
- jQuery的基本过滤器与jQuery实现隔行换色实例
- typescript-koa-postgresql 实现一个简单的rest风格服务器 —— 连接 postgresql 数据库
- 记一次完整的pc前端整站开发
- javascript:void(0) 真正含义
- Redis全方位详解--磁盘持久化和容灾备份
- 《java虚拟机》----线程安全和锁优化
- [Algorithm] Construct a Binary Tree and Binary Search
- debug运行java程序报错
- SQL语句中生成UUID方法
热门文章
- JavaScript入门学习(0)相关 软件工具
- redis学习指南
- else的妙用--if-else 成对出现,可以检测意外的放生,方便找bug
- Ruby中Enumerable模块的一些实用方法
- package html to native application
- 20155231 2016-2017-2 《Java程序设计》第3周学习总结
- 20155304田宜楠-第三次作业:虚拟机的安装与Linux学习
- 20155327 2016-2017-2 《Java程序设计》第一周学习总结
- 考研编程练习----Prim算法的c语言实现
- python 多线程笔记(3)-- 线程的私有命名空间