Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 2.17 KB

README.md

File metadata and controls

59 lines (45 loc) · 2.17 KB

Data Structures and algorithms in Java

This is a repository that contains java algorithms and data structures. This project aims to learn, your contribution is welcome, whether it is correction of some poorly written code or something related.

Available topics and functions

Recursions

  • recursivePrintNumbers(int number);
  • factorial(int number);
  • fibonacci(int number);
  • sumOfDigit(int number);
  • power(int number, int power);
  • greaterCommuneDivisor(int aNumber, int bNumber);
  • intToBinary(int number);
  • reverseString(String reversibleString);

Arrays

  • sortArrayAsc(int... array);
  • sortArrayAsc(String... array);
  • averageValue(int ...array);
  • contains(int value, int... array);
  • indexOf(int value, int ...array);
  • removeValueAtIndex(int index,int ... array);
  • isSubArray(int[] subArray,int ...array);
  • sumUniqueNumbers(int ...array);
  • isUniqueOnArray(int value,int ...array);

Linked Lists

SingleLinkedList

  • insert(int element); Time complexity = [Best case - O(1) Worst case O(n)]
  • getFirst(); Time complexity = [Best case - O(1) Worst-case O(1)]
  • getLast(); Time complexity = [Best case - O(1) Worst case O(1)]
  • length(); Time complexity = [Best case - O(1) Worst case O(1)]
  • toString(); Time complexity = [Best case - O(1) Worst case O(n)]
  • insertHead(int element); Time complexity = [Best case - O(1) Worst case O(1)]
  • insertAt(int index,int element); Time complexity = [Best case - O(1) Worst case O(n)]
  • toArray(); Time complexity = [Best case - O(1) Worst case O(n)]

DoubleLinkedList

  • insertEnd(int element); Time complexity = [Best case - O(1) Worst case O(n)]
  • getLength(); Time complexity = [Best case - O(1) Worst case O(1)]
  • toString(); Time complexity = [Best case - O(1) Worst case O(n)]
  • insertHead(int element); Time complexity = [Best case - O(1) Worst case O(1)]
  • insertAt(int index,int element); Time complexity = [Best case - O(1) Worst case O(n)]
  • deleteAt(int index); Time complexity = [Best case - O(1) Worst case O(n)]
  • updateAt(int index); Time complexity = [Best case - O(1) Worst case O(n)]
  • toArray(); Time complexity = [Best case - O(1) Worst case O(n)]

License

MIT

Author Nelson Alexandre Mutane