三九宝宝网宝宝教育写作范文

用java编写程序实现单链表要提供插入删除排序统计等功能

02月21日 编辑 39baobao.com

[用java怎么实现统计一英文文档里各个英语字母的个数及所占百分比]import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Test { public static void main(String[] args) throws IOExcept...+阅读

public class Link { Node head = null; Node point = null; Node newNode = null; public int Count = 0;//统计值 //插入 public void AddNode(int t) { newNode = new Node(); if (head == null) { head = newNode; } else { point = head; while (point.next != null) { point = point.next; } point.next = newNode; } point = newNode; point.vlaue = t; point.next = null; Count++; } //返回值 public int GetValue(int i) { if (head == null || i < 0 || i > Count) return -999999; int n; Node temp = null; point = head; for (n = 0; n <= i; n++) { temp = point; point = point.next; } return temp.vlaue; } //删除 public void DeleteNode(int i) { if (i < 0 || i > Count) { return; } if (i == 0) { head = head.next; } else { int n = 0; point = head; Node temp = point; for (n = 0; n < i; n++) { temp = point; point = point.next; } temp.next = point.next; } Count--; } //排序 public void Sotr() { for (Node i = head; i != null; i = i.next) { for (Node j = i.next; j != null; j = j.next) { if (i.vlaue > j.vlaue) { int t = i.vlaue; i.vlaue = j.vlaue; j.vlaue = t; } } } } } class Node { int vlaue; Node next; }

以下为关联文档:

Java一个关于统计一句话中字母个数的程序!import java.io.*; import java.util.*; public class Test { static Map<Character, Integer> m = new HashMap<Character, Integer>(); private void add(String s) { cha...

用c语言编写简单学生成绩统计软件#include<stdio.h> int main() { float mark1,mark2,c; int you=0; for(;;) { printf("请输入两门课程的成绩_____\b\b\b\b\b"); scanf("%f,%f",&mark1,&mark2); c=(mark1+mark2)/...

用SQL语句实现一个统计功能请高手帮忙不胜感激select col as A,count (1) as B from (select case A when '1' then 'A',when '2' then 'B' when '3' then 'C' when '4' then 'D' when '5' then 'E' when '6&#...

几种经典排序算法优劣比较的C程序实现一、低级排序算法1.选择排序 (1)排序过程 给定一个数值集合,循环遍历集合,每次遍历从集合中选择出最小或最大的放入集合的开头或结尾的位置,下次循环从剩余的元素集合中遍历找出...

求数据结构图书管理系统源程序要求实现以下功能#include#include#include#include//输入/输出文件流类 using namespace std; const int Maxr=100;//最多的读者 const int Maxb=100;//最多的图书 const int Maxbor=5;//每位...

怎么用java实现一个简单的学生管理系统用java写的话,可以用List来实现学生管理系统: 首先,管理系统是针对学生对象的,所以我们先把学生对象就写出来: package bean; public class Student { String name; String stude...

编写一个应用程序用1 6之间的随机数来模拟掷骰子游戏统计扔public class Test{ public static void main(String args []){ int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0; for(int q=0;q<5000;q++){ int w=1+(int)(Math.random()*6); if(w==1)...

用java编写一个图书馆图书借阅管理系统--------------------------------------------------- 给你修改了三个地方: 1.borrowBooks方法中,将System.out.println("你要借吗?"); 改为: System.out.println("你要借吗?输入1表示...

用Java开发双色球随机选号的程序import java.util.ArrayList; import java.util.HashSet; import java.util.Random; public class Test{ public static void main(String[] args) throws Exception { Arra...

推荐阅读
图文推荐