Typically you can push to this data structure as it can expand
indefinitely
Associative Array Can use integers or have mapped "keys", languages like PHP
and JavaScript support this type of structure and is the actual Queue
type. FIFO - First in First Out
Typically used when the order of transactions is critical
Variations
Array
Objects uses integers as the index
LIFO - Last in First Out
typically cannot expand Stack Typically used in a recursive fashion where "Backtracking" is
required
This is strictly a "key-value" mapped storage structure
Graphs Hash Map (Dictionary) (Map) Used in Some types of databases as an "index" for quick 1-1
key-value access
General Tree
Has a root
Variations can have any number of children under a node
typically used for maps and polygon mapping
This a node based linear structure with a head (aka root)
Node Map of any type or structure
Linked List
does not need a root but most variations do can only have one child under a node
Blob
a binary primitive Binary Tree
typically used in databases
Data Types/Structures Double This a node based tree structure
a decimal approximation combined with a wider set of integers
Float
a decimal approximation combined with an integer
can have 2 children under a node
Primitives any non-fractional number
Integer
typically used in databases as an "index" for quick less-than or
Has a length of more than 1 greater than operations
Requires that the data be in a tree data structure
String
Binary Search Tree Made up of characters
Uses a binary tree graph
Has a length of 1
Search has a root
follows the graph to find the search term Character
Usually a symbol defined in ASCII or UTF-8
O(log(n)) O(n) Speed and Structure Relationship
Binary Search How are these related?
Looks at the array and decides which side to look for the search When should you think about the data structure?
term Search & Sort Algorithms and Data Structures
How can you identify the data structure to use?
Starts with a sorted array
Linear Search
start off with a random array of things, keep splitting them until
Goes through each element you have 1 item in each array, merge them in order
O(n log(n))
Slowest when the search term is last O(n) Merge Sort
Predictable since the size of the array is most important and will
Fastest when the search term is first O(1) determine the speed of the sort
For database engines, this is used quite often due to its stable
properties (stable means that the order of same rank elements
Sort will stay the same)
The simplest version of this algorithm always has a speed of
O(n)
Slowest: Reverse Sorted Array O(n^2)
Bubble Sort
Fastest: Sorted Array O(n)
Quick Sort
Insertion Sort
Fastest: When Slowest: Sorted Array O(n^2)
pivots stay in the Fastest Reverse Sorted Array O(n)
center for a
randomly ordered
array. O(n)
Slowest: When pivot is moving a lot in a sorted or reverse sorted
array O(n^2)
This algorithm is used when it is almost assured that the data will
be randomly ordered.
This is an unstable partitioning sort. (Unstable means the order
will change for elements in the same order rank)