算法题1:1,1,2,3,5,8,13,21,34,55...请用递归的方法求出第30个数字。
算法题2:使用冒泡法进行排序。
- public class MaoPaoPaiXu {
- public static void main(String[] args)
- {
- int [] arr = {3,5,2,7,9};
- int temp = 0;
- for(int i = 0 ;i<arr.length;i++)
- {
- for(int j = 0;j<arr.length-1;j++)
- {
- if(arr[i]<arr[j])
- {
- temp = arr[i];
- arr[i] = arr[j];
- arr[j] = temp;
- }
- }
- }
- for(int k :arr)
- {
- System.out.println(k);
- }
- }
- }
数据库题:多表查询