기술
Objective-C로 Array, Search, Sort, Number, Data Structures를 구현한 오픈소스.
프리지크
2013. 11. 26. 09:41
반응형
컴퓨터 공학에서의 여러 알고리즘들. 사용할 일이 자주 있지는 않지만, 그래서 잊어버리기 쉬운 것들이라 가끔씩 되새겨줘야한다. 기초는 언제나 튼튼하게.
EKAlgorithms ( https://github.com/EvgenyKarkan/EKAlgorithms )
Array
- Index of maximum element in array.
- Find longest string in array of strings.
- Find shortest string in array of strings.
- Array reverse.
- Intersection of two arrays.
- Union of two arrays (with remove duplicates).
- Find duplicates.
- Array with N unique/not unique random objects.
Search
- Linear search.
- Binary search.
Sort
- Bubble sort.
- Shell sort.
- Merge sort.
- Quick sort.
- Insertion sort.
- Selection sort.
- Heap sort.
String
- Palindrome or not.
- String reverse.
- Words count.
- Permutations of string.
- Occurrences of each character (a - z).
- Count "needles" in a "haystack".
- Random string.
- Concatenation of two strings.
- Find 1st occurrence of "needle" in a "haystack".
- Last occurrence of "needle" in a "haystack".
Number
- Sieve of Eratosthenes.
- Great common divisor (GCD).
- Least common multiple (LCM).
- Factorial.
- Fibonacci numbers.
- Sum of digits.
- Binary to decimal conversion.
- Decimal to binary conversion.
- Fast exponentiation.
- Number reverse.
- Even/odd check.
- Leap year check.
- Armstrong number check.
- Prime number check.
- Swap the value of two NSInteger pointers.
Data structures
- Stack (LIFO).
- Queue (FIFO).
- Deque.
- Linked list.
- Graph
- DFS (depth-first search);
- BFS (breadth-first search).
- Binary search tree (BST).
반응형