随笔分类 - introduce to algorithm
algorithm
摘要:冒泡排序 Bubble Sort O(N^2) 选择排序 select sort 是一种简单直观的排序算法。它的工作原理如下。首先在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,然后,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。以此类推,直到所有元素均排序完毕。
阅读全文
摘要:DFS : depth first search BFS: breadth first search DFS : 46. Permutations Given a collection of distinct numbers, return all possible permutations. Fo
阅读全文
摘要:Description: Count the number of prime numbers less than a non-negative number, n.
阅读全文
摘要:hashmap map key and value for highly efficient lookup.hashmap search used binary tree O(log2)main methodsint size();hashmap.put(key,value);Value get(k...
阅读全文
摘要:Rotate ListGiven a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3-...
阅读全文
摘要:Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a...
阅读全文
摘要:Linklist定义:node includes pointer(next) and value区别(与Array):Array has indice,which is in sequence,LinkList has pointer to next.single list and double l...
阅读全文

浙公网安备 33010602011771号