What is data structure?
A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.
- selection sort
- bubble sort
- cocktail sort
- insertion sort
- bucket sort
- recursion
- quick sort
- merge sort
Linked list is the suitable efficient data structure.
Data Structure
|
Advantages
|
Disadvantages
|
---|---|---|
Array
|
Quick inserts
Fast access if index known<
|
Slow search
Slow deletes
Fixed size
|
Ordered Array
|
Faster search than unsorted array
|
Slow inserts
Slow deletes
Fixed size
|
Stack
|
Last-in, first-out acces
|
Slow access to other items
|
Queue
|
First-in, first-out access
|
Slow access to other items
|
Linked List
|
Quick inserts
Quick deletes
|
Slow search
|
Binary Tree
|
Quick search
Quick inserts
Quick deletes
(If the tree remains balanced)
|
Deletion algorithm is complex
|
Red-Black Tree
|
Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)
|
Complex to implement
|
2-3-4 Tree
|
Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)
(Similar trees good for disk storage)
|
Complex to implement
|
Hash Table
|
Very fast access if key is known
Quick inserts
|
Slow deletes
Access slow if key is not known
Inefficient memory usage
|
Heap
|
Quick inserts
Quick deletes
Access to largest item
|
Slow access to other items
|
Graph
|
Best models real-world situations
|
Some algorithms are slow and very complex
|
http://www.corejavainterviewquestions.com/idiots-guide-big-o/
http://www.cs.armstrong.edu/liang/animation/
http://www.careerride.com/Data-Structure-Interview-Questions.aspxhttp://www.sanfoundry.com/java-programming-examples-data-structures/
http://www.geeksforgeeks.org/data-structures/
http://java2novice.com/
Sorting Algorithms Redux 01
https://www.youtube.com/watch?v=aAnISzVGyzI