数据结构
文章平均质量分 75
时间杀手Time
个人博客:
http://zhiml.cn
展开
-
数据结构(严蔚敏)视频百度云
数据结构(严蔚敏)视频百度云原创 2016-08-28 19:00:39 · 11759 阅读 · 0 评论 -
MD5摘要算法
import java.util.Scanner; public class MD5 { static final String hexs[]={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; //标准的幻数 private static final long A=0x67452301L原创 2016-10-05 22:49:52 · 1179 阅读 · 0 评论 -
02-线性结构2 一元多项式的乘法与加法运算 (20分)
设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。零多项式应输出0 0。 输入样例: 4 3 4 -5 2原创 2016-10-07 19:54:26 · 437 阅读 · 0 评论 -
KMP算法详解
如果机房马上要关门了,或者你急着要和MM约会,请直接跳到第六个自然段。 我们这里说的KMP不是拿来放电影的(虽然我很喜欢这个软件),而是一种算法。KMP算法是拿来处理字符串匹配的。换句话说,给你两个字符串,你需要回答,B串是否是A串的子串(A串是否包含B串)。比如,字符串A="I'm matrix67",字符串B="matrix",我们就说B是A的子串。你可以委婉地问你的MM:“假如转载 2016-08-27 12:32:02 · 657 阅读 · 0 评论 -
03-树3 Tree Traversals Again (25分)
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac原创 2016-10-13 23:45:27 · 838 阅读 · 0 评论 -
(2016秋数据结构课后练习题总结)03-树2 List Leaves (25分)
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one test case. For each case, the first line gives a原创 2016-09-16 21:26:42 · 3703 阅读 · 0 评论 -
(2016秋数据结构课后练习题总结)03-树1 树的同构 (25分)
给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵二叉树树的信息。对于每棵树,首先在一行中给出一个非负整数NNN (≤1原创 2016-09-16 21:25:08 · 1337 阅读 · 0 评论 -
利用栈将十进制转换为二进制
import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Stack stack = new Stack(); Scanner scan = new原创 2016-10-05 19:39:32 · 6429 阅读 · 1 评论 -
05-树8 堆中的路径 (25分)
将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。 输入格式: 每组测试第1行包含2个正整数NNN和MMM(≤1000\le 1000≤1000),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的NNN个要被插入一个初始为空的小顶堆的整数。最后一行给出MMM个下标。 输出格式: 对输入原创 2016-10-02 17:07:44 · 822 阅读 · 0 评论 -
05-树9 File Transfer (25分)
We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to send a file from any computer原创 2016-10-03 21:07:30 · 1438 阅读 · 0 评论 -
java实现单链表逆转
import java.text.DecimalFormat; import java.util.Scanner; class Node{ int address; int data; int nextAddress; Node next; public Node(){ } public Node(Node next){ this.next = next; }原创 2016-10-09 15:11:31 · 1680 阅读 · 0 评论 -
(2016秋数据结构课后练习题总结)02-线性结构4 Pop Sequence (25分)
Given a stack which can keep MMM numbers at most. Push NNN numbers in the order of 1, 2, 3, ..., NNN and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop s原创 2016-09-10 21:20:10 · 1211 阅读 · 0 评论