天天看点

银行数据库笔试编程题

一、写一个算法对1,8,5,2,4,9,7进行顺序排列并给出所使用方法。

  我所用的方法:

int[] a={1,8,5,2,4,9,7};

  for(int i=0;i<a.length;i++){

   for(int j=i+1;j<a.length;j++){

    if(a[i]>a[j]){

     //通过交换位置进行排序

     int k=a[i];

     a[i]=a[j];

     a[j]=k;

    }

   }

   system.out.print(a[i]+",");

  }

  编程思想:看到题目上的数字,首先应该想到循环输出,自然想到for循环了,接下来就要思考输出的顺序了。对于新手来说顺序输出应该有点难度,通过比较数字大小来排序输出,利用数组顺序输出并在控制台打印出。

  在网上搜集到的方法:

//用连性表的 形式 这样可以做到释放内存 同时高速排序数量小的情况 用楼上的 数量多 用这种 高速高效

  treemap demo = new  treemap();

     demo.put("1",null);

     demo.put("8",null);

     demo.put("5",null);

     demo.put("2",null);

     demo.put("4",null);

     demo.put("9",null);

     demo.put("7",null);

     iterator it= demo.keyset().iterator();

     while(it.hasnext()){

       system.out.print(it.next()+",");

     }

     it.remove();

     demo.clear();

  二、一个简单的银行账务系统,其数据大致涉及:

  客户(客户名、身份证号,年龄,性别,住址,电话);

  存款账户(账号,类别,余额);

  存款帐分录(交易日期,借贷标志,金额)。

  2.列出某客户(张三)之所有账户号;

  3.李四是一位新开户的客户,添加所涉及的数据库表;

  4.列出客户(李四)在2012/3/1到2012/3/7期间发生的交易金额记录。

最新内容请见作者的github页:http://qaseven.github.io/