摘要: ``` public class Reverse { private String input; private String output; public Reverse(String in) { input = in; } public String doRev() { int stackSiz 阅读全文
posted @ 2017-12-04 16:06 Mmsumz 阅读(189) 评论(0) 推荐(0) 编辑
摘要: ``` /** * 这是一个用java演示数组元素入栈和出栈的程序 * @author S * */ public class StackApp { public static void main(String[] args) { // newStackX对象,并定义栈容量 StackX theStack = new StackX(10); ... 阅读全文
posted @ 2017-11-23 14:50 Mmsumz 阅读(286) 评论(0) 推荐(0) 编辑
摘要: ``` /* * objectSort.java * demonstrate sorting objects (use insertion sort) */ public class Person { private String firstname; private String lastname; private int age; // cons... 阅读全文
posted @ 2017-11-21 10:01 Mmsumz 阅读(152) 评论(0) 推荐(0) 编辑
摘要: ``` /* * insertSort.java * demonstrates insertion sort */ public class ArrayIns { //creat array private long[] a; private int nElems; //constructor public ArrayIns(int max) ... 阅读全文
posted @ 2017-11-20 11:13 Mmsumz 阅读(72) 评论(0) 推荐(0) 编辑
摘要: ``` / selectSort.java demonstrates selection sort use long[] a for example / public class ArraySel { //ref array private long[] a; private int nElems; 阅读全文
posted @ 2017-11-17 22:33 Mmsumz 阅读(67) 评论(0) 推荐(0) 编辑
摘要: ``` /* * bubbleSort.java * demonstrates bubble sort * use long[] a for example */ package pers.sort_bubble; class ArrayBub { private long[] a; //ref to array a private int nElems; ... 阅读全文
posted @ 2017-11-17 13:22 Mmsumz 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 计算机中,所有数据最终都是使用二进制数表达。 不过,一个负数如何用二进制表达。 比如,假设有一 int 类型的数,值为5,那么,我们知道它在计算机中表示为: 00000000 00000000 00000000 00000101 5转换成二制是101,不过int类型的数占用4字节(32位),所以前面 阅读全文
posted @ 2017-06-06 14:45 Mmsumz 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 为什么需要八进制和十六进制? 编程中,我们常用的还是10进制……必竟C/C++是高级语言。 比如: int a = 100,b = 99; 不过,由于数据在计算机中的表示,最终以二进制的形式存在,所以有时候使用二进制,可以更直观地解决问题。 但,二进制数太长了。比如int 类型占用4个字节,32位。 阅读全文
posted @ 2017-06-06 14:38 Mmsumz 阅读(593) 评论(0) 推荐(0) 编辑
摘要: Problem You have been given a String S. You need to find and print whether this string is a palindrome or not. If yes, print "YES" (without quotes), e 阅读全文
posted @ 2017-05-31 10:32 Mmsumz 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Problem You have been given a String S consisting of uppercase and lowercase English alphabets. You need to change the case of each alphabet in this S 阅读全文
posted @ 2017-05-27 14:48 Mmsumz 阅读(234) 评论(0) 推荐(0) 编辑