数据结构与算法
Java研究僧
这个作者很懒,什么都没留下…
展开
-
Dijkstra算法求最短距离并输出路径(Java实现)
package other;/* *Dijkstra,最短路径算法 */public class Dijkstra { public static final int M = -1; static int[][] map = { { 0, 8, 1, 2, M }, { 8, 0, M, 3, M }, { 1, M, 0, 2,原创 2017-09-23 21:33:54 · 3420 阅读 · 0 评论 -
从顺序表中删除所有值为x的元素(Java实现),要求时间复杂度O(n),空间复杂度O(1)
private int maxLength; private int[] a; private int size; public SeqList(int maxLength){ this.maxLength = maxLength; a = new int[maxLength]; size = 0; } //删除所有原创 2017-09-25 16:09:02 · 2463 阅读 · 0 评论 -
用Java实现顺序表及其基本操作
package lwh.linearlist.seqlist;import java.util.Arrays;public class SeqList { private int maxLength = 10; private int[] a; private int size; public SeqList(){} public SeqList(int[] b){原创 2017-09-28 15:17:35 · 4609 阅读 · 1 评论 -
在带头节点的单链表中,删除所有值为x的节点(Java实现)
方法一:public void deleteAllx1(int x){ Node p = head.next; Node q = head; while(p != null){ while(p != null && p.e != x){ q = p; p = p.n原创 2017-10-07 10:13:30 · 4120 阅读 · 2 评论 -
带头节点的单链表及其基本操作(Java实现)
package lwh.linearlist.linklist;public class Node { protected int e; protected Node next; public Node(){}; public Node(int e){ this.e = e; } public Node(int e, Node next){原创 2017-10-11 08:37:50 · 3520 阅读 · 1 评论 -
不带头节点的单链表及其基本操作(Java实现)
package lwh.linearlist.linklist;public class Node { protected int e; protected Node next; public Node(){}; public Node(int e){ this.e = e; } public Node(int e, Node next){原创 2017-10-11 08:39:42 · 3278 阅读 · 0 评论 -
带头节点的双链表及其基本操作(Java实现)
package lwh.linearlist.linklist;public class DbNode { protected int e; protected DbNode next; protected DbNode previous; public DbNode(){} public DbNode(int e){ this.e = e;原创 2017-10-11 08:41:15 · 825 阅读 · 0 评论