Skip to content

lemenendez/algo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms library

Index

  1. Array Linear Search arrays basic generics avg O(n/2) best O(1) worst O(n)
  2. Array Append arrays basic generics O(n) resizing
  3. Array Insert arrays basic generics O(n) resizing
  4. Array Delete basic generics resizing O(n)
  5. Linked List Append generics arrays append O(1)
  6. Linked List Merge generic ordered arrays merge O(n+m)
  7. Bubble Sort generics swap array sorting
  8. Hoare Partitions generics array hoare sorting O(n) space complexity O(1)
  9. Common Words strings O(n+m)
  10. Two Sum arrays O(n) *
  11. K Closest Points arrays O (N * Long(N)) * **
  12. Queue generic queue using an slice
  13. Neuron basic neuron
  • * study later
  • *** try to make it simpler

Array Vs Linked List

Arrays will be faster than linked lists for most applications. This is because arrays are stored in contiguous memory locations, which makes it easy to access elements using an index. Linked lists, on the other hand, require traversing the list to find an element, which can be slower.

Use arrays when the number of elements is known in advance and when you need to access elements by index. When accessing the elements is a common operation, arrays are a better choice. Array access time is O(1) while linked list is O(n). Binary search, interpolation search, quick sort, and merge sort are all faster with arrays.

Use linked lists when the number of elements is not known in advance and when you need to insert or delete elements. The most common use case of Linked List is the implementation of undo operation in Browsers and editing software. If you require an array of linked list for hashing, you can use a linked list to handle collisions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages