`
liuyiyou
  • 浏览: 23426 次
  • 性别: Icon_minigender_1
  • 来自: 湖南
社区版块
存档分类
最新评论
文章列表
插入排序: 思想:插入排序的基本操作就是将一个数据插入到已经排好序的有序数据中,从而得到一个新的、个数加一的有序数据,算法适用于少量数据的排序,时间复杂度为O(n^2)。是稳定的排序方法 public static void insertSrot(int[] arr) { for (int i = 1; i < arr.length; i++) { int j = i; int target = arr[i]; while (j > 0 && target < arr[j ...
思想:每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在已排好序的数列的最后,直到全部待排序的数据元素排完。 选择排序是不稳定的排序方法。public static void selectSort(int[] arr) { int index = 0; int temp = 0; for (int i = 0; i < arr.length - 1; i++) { index = i; for (int j = i + 1; j < arr.length; j++) { ...
模拟hibernate,实现了增删改查以及按id查询 public class PrePareSql { public static String selectSql(Class<?> obj) { String sql = "select "; Field[] fields = obj.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (i < fields.length - 1) { sql = sql + fields ...
选择排序: 思想:每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在已排好序的数列的最后,直到全部待排序的数据元素排完。 选择排序是不稳定的排序方法。 public static void selectSort(int[] arr) { int index = 0; int temp = 0; for (int i = 0; i < arr.length - 1; i++) { index = i; for (int j = i + 1; j < arr.length; j++) { if (arr[j] < arr[index]) { ...
hibernate查询的6种方法。分别是HQL查询 ,对象化查询Criteria方法,动态查询DetachedCriteria,例子查询,sql查询,命名查询。 如果单纯的使用hibernate查询数据库只需要懂其中的一项就可以完成想要实现的一般功能,但是 从一个点,让我们掌握6中方法,则提供了更多选择。每一种方法都有其适用的情况与前提。 HQL查询 HQL是hibernate自己的一套查询语言,于SQL语法不同,具有跨数据库的优点。示例代码: <!-- Code highlighting produced by Actipro CodeHighlighter (freewa ...
Global site tag (gtag.js) - Google Analytics