Java数据结构和算法(一)线性结构之单链表 prev current next -------------- -------------- -------------- | value | next | -> | value | next | -> | value | next | -------------- -------------- -------------- 单链表的结构如上:最后一个节点的 next=null.下面看一下代码. (1) 链表的基本操作 public class…
[java基础]循环结构1 循环结构:for循环,while循环,do_while循环在,增强型for循环 /** 文件路径:G:\JavaByHands\循环语句\ 文件名称:WhileTest.java 编写时间:2016/6/7 作 者:郑晨辉 编写说明:while do while 代码示例 */ public class WhileTest{ public static void main(String[] args){ //初始条件 int i = 0; //进入循环,while循环…
[java基础]分支结构2 switch case /** 文件路径:G:\JavaByHands\if-else\ 文件名称:switchcase.java 编写时间:2016/6/6 作 者:郑晨辉 编写说明:switch case代码示例 */ public class switchcase { public static void main(String[] args){ int a = 4; switch(a){ case(1): System.out.println("输出的是1&q…
数据结构实验之链表七:单链表中重复元素的删除 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 按照数据输入的相反顺序(逆位序)建立一个单链表,并将单链表中重复的元素删除(值相同的元素只保留最后输入的一个). Input 第一行输入元素个数 n (1 <= n <= 15):第二行输入 n 个整数,保证在 int 范围内. Output 第一行输出初始链表元素个数:第…