欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOC文档下载
    分享到微信 分享到微博 分享到QQ空间

    武汉纺织大学《数据结构》实验报告文档格式.doc

    • 资源ID:249536       资源大小:467.50KB        全文页数:23页
    • 资源格式: DOC        下载积分:1金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要1金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    武汉纺织大学《数据结构》实验报告文档格式.doc

    1、 e(i)=ve(j) l(i)=vl(k)-dut()求ve(i)和vl(j)分两步: (1).从ve(1)=0开始向前递推ve(j)=Maxve(i)+dut()T, 2=j=n ,其中,T是所有以j为弧头的弧的集合。(2).从vl(n)=ve(n)开始向后递推vl(i)=Minvl(j)-dut() S,1=i=n-1,其中,S是所有以i为弧尾的弧的集合。求关键路径的算法: 、输入e条弧,建立AOE网的存储结构; 、从起始点出发,令ve0=0,按拓扑顺序求其余各顶点的最早发生时间vei(1=i=0); 、根据各顶点的ve和vl值,求每条弧s的最早开始时间e(s)和最迟开始时间l(s)。若

    2、某弧满足条件e(s)=l(s),则为关键活动。三、操作步骤:Test1代码:Graph1.javapackage Frist;public class Graph1 public static void main(String args) String vertices = A, BCDE ;Edge edges = new Edge(0, 1, 5), new Edge(0, 3, 2),new Edge(1, 0, 5), new Edge(1, 2, 7), new Edge(1, 3, 6),new Edge(2, 1, 7), new Edge(2, 3, 8), new Edge(

    3、2, 4, 3),new Edge(3, 0, 2), new Edge(3, 1, 6), new Edge(3, 2, 8),new Edge(3, 4, 9), new Edge(4, 2, 3), new Edge(4, 3, 9) ;AdjMatrixGraph graph = new AdjMatrixGraph(vertices,edges);System.out.println(带权无向图, + graph.toString();插入顶点F,插入边(A,F,20),删除顶点C,删除边(D,E);int i = graph.insertVertex(Fgraph.insertEd

    4、ge(0, i, 20);graph.insertEdge(i, 0, 20);graph.removeVertex(2);graph.removeEdge(2, 3);graph.removeEdge(3, 2);System.out.println(graph.toString(); graph1 = new AdjMatrixGraphSystem.out.print(深度优先遍历序列为:graph1.DFSTraverse(0);广度优先遍历序列为:graph1.BFSTraverse(0); graph2 = new AdjMatrixGraph + graph2.toString(

    5、);graph2.minSpanTree_prim();LList.javapublic interface LList boolean isEmpty();int length();T get(int i);void set(int i, T x);void insert(int i, T x);T remove(int i);void removeAll();QQueue.javapublic interface QQueuevoid enqueue(T x);T dequeue();SeqList.javapublic class SeqList implements LList= 0

    6、& i 0)str += this.element0.toString();for (int i = 1; this.len; i+)str += , + this.elementi.toString();return str + )public void insert(int i, T x) if (this.len = element.length) Object temp = this.element;this.element = new Objecttemp.length * 2;for (int j = 0; j temp.length;this.elementi = tempj;i

    7、f (i = i; j-)this.elementj + 1 = this.elementj;this.elementi = x;this.len+;public void append(T x) insert(this.len, x);public T remove(int i) if (this.len = 0 | i = this.len)return null;T old = (T) this.elementi;for (int j = i; this.len - 1; j+)this.elementj = this.elementj + 1;this.elementthis.len

    8、- 1 = null;this.len-;return old;public void removeAll() SeqQueue.javapublic class SeqQueue implements QQueueprivate Object element;private int front, rear;public SeqQueue(int length) if (length 64)length = 64;this.element = new ObjectMath.abs(length);this.front = this.rear = 0;public SeqQueue() retu

    9、rn this.front = this.rear;public void enqueue(T x) if (this.front = (this.rear + 1) % this.element.length) int i = this.front, j = 0;while (i != this.rear) this.elementj = tempi;i = (i + 1) % temp.length;j+;this.front = 0;this.rear = j;this.elementthis.rear = x;this.rear = (this.rear + 1) % this.ele

    10、ment.length;public T dequeue() if (isEmpty()T temp = (T) this.elementthis.front;this.front = (this.front + 1) % this.element.length;return temp;if (!isEmpty() str += this.elementthis.front.toString();int i = (this.front + 1) % this.element.length;str += + this.element.length;GGraph.javapublic interf

    11、ace GGraphpublic static final int MAX_WEIGHT = 99999;int vertexCount();int getWeight(int i, int j);int insertVertex(T x);void insertEdge(int i, int j, int weight);void removeEdge(int i, int j);void removeVertex(int i);int getNextNeighbor(int i, int j);void DFSTraverse(int i);void BFSTraverse(int i);

    12、AbstractGraph.javapublic abstract class AbstractGraph implements GGraphpublic abstract int vertexCount();public abstract T get(int i);public abstract int getNextNeighbor(int i, int j);public void DFSTraverse(int i) boolean visited = new booleanthis.vertexCount();int j = i;do if (!visitedj) System.ou

    13、t.print(this.depthfs(j, visited);j = (j + 1) % this.vertexCount(); while (j != i);System.out.println();private void depthfs(int i, boolean visited) System.out.print(this.get(i) + visitedi = true;int j = this.getNextNeighbor(i, -1);while (j != -1) visitedj)depthfs(j, visited);j = this.getNextNeighbor

    14、(i, j);public void BFSTraverse(int i) breadthfs(j, visited);private void breadthfs(int i, boolean visited) SeqQueue que = new SeqQueue(this.vertexCount();que.enqueue(new Integer(i);while (!que.isEmpty() i = que.dequeue().intValue();int j = this.getNextNeighbor(i, -1);while (j !if (!System.out.print(

    15、this.get(j) + visitedj = true;que.enqueue(new Integer(j);j = this.getNextNeighbor(i, j);public abstract int getWeight(int i, int j);public void minSpanTree_prim() Edge mst = new EdgevertexCount() - 1;for (int i = 0; mst.length;msti = new Edge(0, i + 1, this.getWeight(0, i + 1); i+) int minweight = M

    16、AX_WEIGHT;int min = i;for (int j = i;if (mstj.weight minweight) minweight = mstj.weight;min = j;Edge temp = msti;msti = mstmin;mstmin = temp;int tv = msti.dest;for (int j = i + 1; j+) int v = mstj.dest;if (this.getWeight(tv, v) mstj.weight) msti.weight = this.getWeight(tv, v);mstj.start = tv;n最小生成树边

    17、的集合:int mincost = 0; mst.length - 1;System.out.print(msti + mincost += msti.weight;,最小代价为 + mincost);AdjMatrixGraph.javapublic class AdjMatrixGraph extends AbstractGraphprotected SeqList vertexlist;protected int adjmatrix;private final int MAX_WEIGHT = 99999;public AdjMatrixGraph(int size) size = si

    18、ze 10 ? 10 : size;this.vertexlist = new SeqList(size);this.adjmatrix = new intsizesize;this.adjmatrixij = (i = j) ? 0 : MAX_WEIGHT;public AdjMatrixGraph(T vertices, Edge edges) this(vertices.length);if (vertices = null) vertices.length;insertVertex(verticesi);if (edges != null) edges.length;insertEdge(edgesj);public void insertEdge(int i, int j, int weight) int n = this.vertexCount(); 0 & n & i != j& this.adjmatrixij = MAX_WEIGHT)this.adjmatrixij = weight;pu


    注意事项

    本文(武汉纺织大学《数据结构》实验报告文档格式.doc)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开