본문 바로가기
기술

Objective-C로 Array, Search, Sort, Number, Data Structures를 구현한 오픈소스.

by 프리지크 2013. 11. 26.
반응형

컴퓨터 공학에서의 여러 알고리즘들. 사용할 일이 자주 있지는 않지만, 그래서 잊어버리기 쉬운 것들이라 가끔씩 되새겨줘야한다. 기초는 언제나 튼튼하게. 


EKAlgorithms ( https://github.com/EvgenyKarkan/EKAlgorithms )

Array

  1. Index of maximum element in array.
  2. Find longest string in array of strings.
  3. Find shortest string in array of strings.
  4. Array reverse.
  5. Intersection of two arrays.
  6. Union of two arrays (with remove duplicates).
  7. Find duplicates.
  8. Array with N unique/not unique random objects.

Search

  1. Linear search.
  2. Binary search.

Sort

  1. Bubble sort.
  2. Shell sort.
  3. Merge sort.
  4. Quick sort.
  5. Insertion sort.
  6. Selection sort.
  7. Heap sort.

String

  1. Palindrome or not.
  2. String reverse.
  3. Words count.
  4. Permutations of string.
  5. Occurrences of each character (a - z).
  6. Count "needles" in a "haystack".
  7. Random string.
  8. Concatenation of two strings.
  9. Find 1st occurrence of "needle" in a "haystack".
  10. Last occurrence of "needle" in a "haystack".

Number

  1. Sieve of Eratosthenes.
  2. Great common divisor (GCD).
  3. Least common multiple (LCM).
  4. Factorial.
  5. Fibonacci numbers.
  6. Sum of digits.
  7. Binary to decimal conversion.
  8. Decimal to binary conversion.
  9. Fast exponentiation.
  10. Number reverse.
  11. Even/odd check.
  12. Leap year check.
  13. Armstrong number check.
  14. Prime number check.
  15. Swap the value of two NSInteger pointers.

Data structures

  1. Stack (LIFO).
  2. Queue (FIFO).
  3. Deque.
  4. Linked list.
  5. Graph
    • DFS (depth-first search);
    • BFS (breadth-first search).
  6. Binary search tree (BST).


반응형