] GOAL PAPER - data structures for dummies - an attempt at gaining a better understanding of data structures and their use.
] define: data structure
] a computer science construct, a data structure defines a formal method for storing data to best acheive a particular results (ex fast searching).
] there are several different types of data structures, some of the main types included Lists, Graphs, Trees. Each of the main types include have many subtypes (aka variants), ex Trees hav B-Trees,
*wik] a particular way of organizing data in a computer so that it can be used efficiently. Data structures can implement one or more particular abstract data types, which are the means of specifying the contract of operations and their complexity. In comparison, a data structure is a concrete implementation of the contract provided by an ADT.
WHY
] a particular way of organizing data in a computer so that it can be used efficiently.
] usage of the the correct type of data structures can result in alogrithms that perform orders of magnitude more efficiently than where improper data structures were used.
WHEN
] you get the google interview, your standing in front of the whiteboard, in front of the interview panel, they ask
] can you implement an example of a {linked list} in <insert programming language>,
] a collection of related data elements, contiguous may be a fixed size or expandable(dynamic), each element is accessed by its numeric index
] Records (also called tuples or structs or class)
] are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed by names. The elements of records are usually called fields or members.
] DISTINCT: record (data only) and class (data + code that operates on that data, template to create object)
] type specifies which of a number of permitted primitive types may be stored in its instances, e.g. "float or long integer". Contrast with a record, which could be defined to contain a float and an integer; whereas, in a union, there is only one value at a time. Enough space is allocated to contain the widest member datatype.
] tagged union (also called a variant, variant record, discriminated union, or disjoint union)
] contains an additional field indicating its current type, for enhanced type safety.
] abstract data types
*] Array - a collection of related data elements, accessed by their index
] Container -
>] Map/Associative array/Dictionary -Map (aka dictionary) are key/value pairs. Give a map a key and it will return the associated value4.
] Set is an abstract data structure ] that can store specific values, without any particular order, and with no repeated values. Values themselves are not retrieved from sets, rather one tests a value for membership to obtain a boolean "in" or "not in".
>] Queue - FIFO the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection.
] Queues provide services in computer science, transport, and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue performs the function of a buffer
] Tree - recursive data structures consisting of nodes with children, a restricted form of a Graph(4), have direction (parent / child relationships) and don't contain cycles. They fit with in the category of Directed Acyclic Graphs (or a DAG). So Trees are DAGs with the restriction that a child can only have one parent.
] Array - stores a number of elements in a specific order. They are accessed using an integer (index) to specify which element is required (although the elements may be of almost any type). Typical implementations allocate contiguous memory words for the elements of arrays (but this is not always a necessity). Arrays may be fixed-length or expandable.
>] Trees are linkedabstract data structures composed of nodes. ] Each node contains a value and also one or more pointers to other nodes. ] trees are generally used for sorting and searching, having their nodes arranged in some relative order based on their values.