摘要:
冒泡排序 思想 从左到右两两比较,如果逆序,则交换。 若数组中有N的数据项目,第一趟排序中有N 1次比较,第二趟有N 2比较。。。共有(N 1)+(N 2)+...+1=N(N 1)/2 所以冒泡算法需要O(N2) 选择排序 思想 选择排序改进了冒泡排序,将必要的交换次数减少到O(N) 选择最小的放 阅读全文
摘要:
为避免前台显示权限菜单是每次都从数据库中读取,使用ServletContextListener在服务器启动和关闭时创建和关闭缓存。 在web.xml配置监听器: 监听器类: 实际上,Tomcat不能检测到Spring容器,而是通过反射生成监听器实例,而将监听器类注入到Spring中,Spring容器 阅读全文
摘要:
最近在做oa系统:角色(Role)和权限(Privilege) 是多对多关系,实体类关系映射采用注解方式 这种配置下中间表会更新,但是如果mappedBy放在角色类中,再更新角色的话,中间表则不会更新,后台也不会报错。 简单说明,因为在权限类中使用了mappedBy指向了角色对象中的privileg 阅读全文
摘要:
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
摘要:
Given an array nums, write a function to move all 0‘s to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
摘要:
Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array A = [1,1,1,2,2,3],Your function should 阅读全文
摘要:
Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for 阅读全文
摘要:
描述Given a string containing just the characters ’(’ and ’)’, find the length of the longest valid (wellformed)parentheses substring.For ”(()”, the lon 阅读全文
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文