Skip to content

Latest commit

 

History

History

data-structures

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Data Structures

Data Structures Complexity

Simple array (fixed array size)

Complexity Value
Access O(1)
Search O(n)
Insert O(n)
Delete O(n)
Space O(n)

Dynamic array (Array list)

Complexity Value
Access O(1)
Search O(n)
Insert O(n)
Delete O(n)
Space O(n)

Linked List

Complexity Value
Access O(n)
Search O(n)
Insert in First O(1)
Delete in First O(1)
Insert O(n)
Delete O(n)
Space O(n)

Should i choose Linked List or Array List?

  • A lot of add/delete => LinkedList
  • Fixed element number => ArrayList
  • Insert one time and a lot of access => ArrayList

Stack

Complexity Value
Access O(n)
Search O(n)
Insert O(1)
Delete O(1)
Space O(n)

Queue

Complexity Value
Access O(n)
Search O(n)
Insert O(1)
Delete O(1)
Space O(n)

Hash Table

Complexity Value
Access O(n)
Search O(n)
Insert O(n)
Delete O(n)
Space O(n * m)