You are on page 1of 2

Data Structures & Algorithms - Defined A data structure is an arrangement of data in a computer's memory or even disk storage.

An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables.Algorithms, on the other hand, are used to manipulate the data contained in these data structures as in searching and sorting. Many algorithms apply directly to a specific data structures. When working with certain data structures you need to know how to insert new data, search for a specified item, and deleting a specific item. Commonly used algorithms include are useful for:
Searching for a particular data item (or record). Sorting the data. There are many ways to sort data. Simple sorting,

Advanced sorting Iterating through all the items in a data structure. (Visiting each item in turn so as to display it or perform some other action on these item. Data Structure Array Advantages Quick inserts Fast access if index known Faster search than unsorted array Last-in, first-out acces First-in, first-out access Quick inserts Quick deletes Quick search Quick inserts Quick deletes (If the tree remains balanced) Quick search Quick inserts Quick deletes (Tree always remains balanced) Quick search Quick inserts Quick deletes Disadvantages Slow search Slow deletes Fixed size Slow inserts Slow deletes Fixed size Slow access to other items Slow access to other items Slow search Deletion algorithm is complex

Ordered Array Stack Queue Linked List Binary Tree

Red-Black Tree

Complex to implement

2-3-4 Tree

Complex to implement

(Tree always remains balanced) (Similar trees good for disk storage) Hash Table Very fast access if key is known Slow deletes Quick inserts Access slow if key is not known Inefficient memory usage Quick inserts Quick deletes Access to largest item Best models real-world situations Slow access to other items

Heap

Graph

Some algorithms are slow and very complex

You might also like