DATA STRUCTURES - CAN THEY BE SERVED A LA CARTE?	

Data structures often neglected. 	

Pseudo code should be used to help modularize	

Impose systematic organization	

!A record - group contains values (-tuple)	

A record has fields - not just rows and columns	

grouped collection	

!data structure - C style “struct”.Very basic, though in Objective C, C++, C# etc.	

not Java, Python, Ruby sort of	

is it a class? struct simpler, no methods. just a package of variables	

pointers 	

C is not oo	

plain old data structures PODs	

!point on screen	

struct Point {	

	

 int x;	

	

 int y;	

};	

or color	

struct Color {	

	

 rgb etc	

};	

!COLLECTIONS	

!The Array - very fundamental (python its “list”)	

An array ordered collection of items given a name, has index	

Linear array. usually 0-based index. fixed size - immutable	

dynamically add or remove items	

data types. restrict size and type is smaller and faster. memory is allocated.
don’t keep your options open! Flexibility introduces overhead.	

!One dimensional array	

Multidimensional array - matrix or table - two dim is array of arrays,
rectangular array	

	

 three dim - [ 1, 3, 11 ] an array of array of array. nesting information.	

not dimensions in the physical world, more like a phone bill	

!Jagged Arrays of different lengths, 	

Resizable Arrays, mutable, like Java ArrayList, NSArray in Obj C, NSMutableArray	

location? myArray.add(99) or myArray.add(99.2) reshuffled around	

!Java 	

 add(value)	

Obj	

 addObject:value	

JS	

 push(value)	

Ruby	

 push(value)	

Python	

 append(value) - append to list	

!Insert at index	

Java 	

 add(index, value)	

Obj	

 addObject:value atIndex:index	

JS	

 splice(….)	

Ruby	

 insert(index, value)	

Python	

 insert(index, value)	

!push, pop (delete last), etc	

!FIVE Fundamental	

1. How to ACCESS	

2. INSERT	

I Can dothis.
right?
3. DELETE	

4. FIND	

5. SORT	

!Sorting	

myArray.sort(); innocent code can be a thunder quake via the SIZE of the array. some languages sort in place, others create a
COPY. How often? How thorough? Computationally intensive.	

!Sorting custom arrays. Comparator / compare function. Easy.	

!	

!!!!!!!!!!Searching arrays	

C has no search. use a for loop etc to manually find it	

!!!!!!!!!!!linear or sequential search - slow brutish and inelegant. sux. is your built in search linear? “check
all the things”	

!Built in search functionality.What type is it? 	

myArray.contains(99)	

myArray.indexOf(99)	

Not good if linear search.Alternative? Maybe there is no other option. 	

!Binary search only on ordered array	

Ascending values. Divide in half. divide in half again.	

Divide and conquer algorithm	

!JS has NO binary search.	

!When do I use a BINARY SEARCH or a LINEAR SEARCH?	

!ARRAY Direct access = random access - located in contiguous place in memory	

Arrays use contiguous memory	

!LINKED LIST no direct access, just a collection. located anywhere in memory. the first node has link to second which has link to
3rd. Must be access sequentially. Changes pointers. Good for volatile and changing data. 	

!	

!!!!!!!
Kind of over
my head here!
SINGLY LINKED LIST	

DOUBLE LINKED LIST - link to pref and next	

Null ref or terminator or sentenal node OR back to the first - CIRCULAR LINKED LIST	

!Java - list is an INTERFACE. Class ArrayList is an array - direct access. LinkedList doubly linked list. Python “lists” are variable
length arrays. etc. 	

!Array vs Linked List?	

!STACKS and QUEUES are collections	

a stack of dirty plates. add to the top. take it from the top. last in, first out LIFO data structure	

push / pop. Pop REMOVES element.What about read or touch element or peek	

myStack.push();	

myStack.pop();	

myStack.peek();	

!ADT Abstract Data Types	

data types - boolean, integer, string, etc. formality, employee	

ABSTRACT stacks queues, linked lists, 	

Abstract Class is a class that you cannot instantiate, must inherit from. NOT same thing.	

!QUEUE	

FIFO - First in First out. Deserts in refrigerator. Multi threading.There are no indexes. One does not insert / remove from
middle. 	

!enqueue add an object to end 	

!Priority Queue	

relative importance. will jump ahead. compare function. 	

Deque = double ended queue. Can add/remove from either end. Dequeue is a verb, method 	

	

Arrays, Linked List, Stacks and Queues	

!ASSOCIATIVE ARRAY	

no numerical index. adds meaning. semantic. 	

Key /Value Pairs	

	

!!!!!!!!!!!!no duplicate keys, must be unique. values can though. 	

A dictionary or hash is an associative.	

!How are these handled in memory? Most Associative Arrays are a HASH TABLE	

!HASH	

chop em up and mix em together. Hash function	

Hash Functions are not invertible are typically one-way	

plate of corned beef hash cannot be turned back into cow and potato	

!!!!!!
my brainjust
exploded.
!!!HASH TABLE - implement assoc arrays. fast. Buckets. add in pairs, key/value	

Hash function	

!SETS very simple data structure	

Unordered collection of objects. No index. No sequence. No key.A bunch of objects in no particular order.What is a set good
at? No duplicates. Cannot add same item.VERY FAST. Fast lookup. 	

mySet.contains(obj2); check for membership.	

!TREE data structure	

nodes have links, connection. Like fixed sequence of linked list, this is more 3 dimensional. Logical. 	

root node - starting place/ pointers object	

child nodes / parent / leaf node (no children) I AM TRYING, PEOPLE	

!Binary tree - never more than 2 child nodes	

BST Binary Search Tree. very searchable. 0, 1, 2. Left child and the right child	

! !!!!!!Naturally SORTED
TREE or 	

Left child node MUST
be less than parent, right child is MORE than parent	

!Unbalanced tree. Self-balancing binary trees - shift position of root node (right or left) 	

number of levels are more eq	

Red Black trees	

AVL trees	

scapegoat trees	

Splay tree	

!!	

!!!!!!!HEAP - data structure, heap sort, binary tree. Heap
implementation	

min heap? or max heap?	

Min heap child must be greater	

Max heap child must be less	

Left/right child doesn't matter	

Swap nodes TOP TO BOTTOM LEFT TO RIGHT, can swap root node	

not really sorted. good for priority queue	

oyvey!
!GRAPH (not a visual chart)	

A graph is a collection of nodes, where any node can link to any other node.And, a node can link to multiple other nodes.
Whatever is meaningful	

!like a social network. No fixed root node.Transportation distance btw cities, complex system of interconnection	

Vertices or edges. direction? Weight	

	

SUMMARY
Arrays 	

+ direct indexing	

+ easy to create and use	

!- sorting and searching	

- inserting and deleting, particularly in the middle	

!Linked Lists
+ inserting and deleting elements	

+ iterating through the collection	

!- direct access	

- searching and sorting	

!Stacks and Queues
+ Designed for LIFO / FIFO	

!- direct access	

- search sort	

!Hash Tables
+ speed of insertion and deletion	

+ speed of access	

!- overhead	

- retrieving in sorted order	

- searching for specific value	

!Sets
+ membership	

+ avoid duplicates	

!- everything else	

!Binary Search Trees
+ speed of insertion and deletion	

+ speed of access	

+ maintain sorted order	

!- overhead	

!Heaps
Fixed structures are faster/smaller. If speed and weight are a concern choose fixed as much as possible.	

Well, it might be worth your while to copy the mutable version into an immutable fixed size version of that data structure. Copy
and change types.	

Try changing from one structure to another. See if it improves performance.	

!NoSQL Databases
DOCUMENT STORE	

self-contained document, not rows/columns	

XML, JSON very loose, no schema, flexibility. Like MongoDB, CouchDB
!KEY-VALUE again no predefined schema. whatever you want in either category	

GRAPH DATABASE very inter relational like Neo4j	

!XML nested	

ORM object relational mapping. Like ActiveRecord (Ruby), Hibernate (Java)	

!
!
DEEP DEVELOPMENT’S HANDSOME HELPING FROM TEAM ACTIVITY
One does not merely walk in Data Structures. Not with 10,000 men could you do that.
Therefore, the UX and the UI has to be considered. Moreover, the same, or at least similar
methodologies can be used to help make more nuanced and modularized decisions about
what to do with data, whether to process on client-side or server-side, distributed systems
and load, etc.
At this point, it may come as little surprise that the benefits of team
cohesion and activities make deep development and data decisions
more contextual. But the side benefit of being able to articulate WHY
they are ordering from the Tapas Menu, mixing and matching, as
opposed from the Big Plates, is a timely one. Americans are
struggling with obesity. And so are their servers.
It’s a teachable moment, as they say. Because there is common
ground, even the most technical blah blah blah can become a real
two-way conversation. And that is going to benefit not only out team,
but it is something tasty we can serve up to the larger company
culture. Other groups may enjoy the fruits of our labor. Bon Appétit!
!
!

DataStructures

  • 1.
    DATA STRUCTURES -CAN THEY BE SERVED A LA CARTE? Data structures often neglected. Pseudo code should be used to help modularize Impose systematic organization !A record - group contains values (-tuple) A record has fields - not just rows and columns grouped collection !data structure - C style “struct”.Very basic, though in Objective C, C++, C# etc. not Java, Python, Ruby sort of is it a class? struct simpler, no methods. just a package of variables pointers C is not oo plain old data structures PODs !point on screen struct Point { int x; int y; }; or color struct Color { rgb etc }; !COLLECTIONS !The Array - very fundamental (python its “list”) An array ordered collection of items given a name, has index Linear array. usually 0-based index. fixed size - immutable dynamically add or remove items data types. restrict size and type is smaller and faster. memory is allocated. don’t keep your options open! Flexibility introduces overhead. !One dimensional array Multidimensional array - matrix or table - two dim is array of arrays, rectangular array three dim - [ 1, 3, 11 ] an array of array of array. nesting information. not dimensions in the physical world, more like a phone bill !Jagged Arrays of different lengths, Resizable Arrays, mutable, like Java ArrayList, NSArray in Obj C, NSMutableArray location? myArray.add(99) or myArray.add(99.2) reshuffled around !Java add(value) Obj addObject:value JS push(value) Ruby push(value) Python append(value) - append to list !Insert at index Java add(index, value) Obj addObject:value atIndex:index JS splice(….) Ruby insert(index, value) Python insert(index, value) !push, pop (delete last), etc !FIVE Fundamental 1. How to ACCESS 2. INSERT I Can dothis. right?
  • 2.
    3. DELETE 4. FIND 5.SORT !Sorting myArray.sort(); innocent code can be a thunder quake via the SIZE of the array. some languages sort in place, others create a COPY. How often? How thorough? Computationally intensive. !Sorting custom arrays. Comparator / compare function. Easy. ! !!!!!!!!!!Searching arrays C has no search. use a for loop etc to manually find it !!!!!!!!!!!linear or sequential search - slow brutish and inelegant. sux. is your built in search linear? “check all the things” !Built in search functionality.What type is it? myArray.contains(99) myArray.indexOf(99) Not good if linear search.Alternative? Maybe there is no other option. !Binary search only on ordered array Ascending values. Divide in half. divide in half again. Divide and conquer algorithm !JS has NO binary search. !When do I use a BINARY SEARCH or a LINEAR SEARCH? !ARRAY Direct access = random access - located in contiguous place in memory Arrays use contiguous memory !LINKED LIST no direct access, just a collection. located anywhere in memory. the first node has link to second which has link to 3rd. Must be access sequentially. Changes pointers. Good for volatile and changing data. ! !!!!!!! Kind of over my head here!
  • 3.
    SINGLY LINKED LIST DOUBLELINKED LIST - link to pref and next Null ref or terminator or sentenal node OR back to the first - CIRCULAR LINKED LIST !Java - list is an INTERFACE. Class ArrayList is an array - direct access. LinkedList doubly linked list. Python “lists” are variable length arrays. etc. !Array vs Linked List? !STACKS and QUEUES are collections a stack of dirty plates. add to the top. take it from the top. last in, first out LIFO data structure push / pop. Pop REMOVES element.What about read or touch element or peek myStack.push(); myStack.pop(); myStack.peek(); !ADT Abstract Data Types data types - boolean, integer, string, etc. formality, employee ABSTRACT stacks queues, linked lists, Abstract Class is a class that you cannot instantiate, must inherit from. NOT same thing. !QUEUE FIFO - First in First out. Deserts in refrigerator. Multi threading.There are no indexes. One does not insert / remove from middle. !enqueue add an object to end !Priority Queue relative importance. will jump ahead. compare function. Deque = double ended queue. Can add/remove from either end. Dequeue is a verb, method Arrays, Linked List, Stacks and Queues !ASSOCIATIVE ARRAY no numerical index. adds meaning. semantic. Key /Value Pairs !!!!!!!!!!!!no duplicate keys, must be unique. values can though. A dictionary or hash is an associative. !How are these handled in memory? Most Associative Arrays are a HASH TABLE !HASH chop em up and mix em together. Hash function Hash Functions are not invertible are typically one-way plate of corned beef hash cannot be turned back into cow and potato !!!!!! my brainjust exploded.
  • 4.
    !!!HASH TABLE -implement assoc arrays. fast. Buckets. add in pairs, key/value Hash function !SETS very simple data structure Unordered collection of objects. No index. No sequence. No key.A bunch of objects in no particular order.What is a set good at? No duplicates. Cannot add same item.VERY FAST. Fast lookup. mySet.contains(obj2); check for membership. !TREE data structure nodes have links, connection. Like fixed sequence of linked list, this is more 3 dimensional. Logical. root node - starting place/ pointers object child nodes / parent / leaf node (no children) I AM TRYING, PEOPLE !Binary tree - never more than 2 child nodes BST Binary Search Tree. very searchable. 0, 1, 2. Left child and the right child ! !!!!!!Naturally SORTED TREE or Left child node MUST be less than parent, right child is MORE than parent !Unbalanced tree. Self-balancing binary trees - shift position of root node (right or left) number of levels are more eq Red Black trees AVL trees scapegoat trees Splay tree !! !!!!!!!HEAP - data structure, heap sort, binary tree. Heap implementation min heap? or max heap? Min heap child must be greater Max heap child must be less Left/right child doesn't matter Swap nodes TOP TO BOTTOM LEFT TO RIGHT, can swap root node not really sorted. good for priority queue oyvey!
  • 5.
    !GRAPH (not avisual chart) A graph is a collection of nodes, where any node can link to any other node.And, a node can link to multiple other nodes. Whatever is meaningful !like a social network. No fixed root node.Transportation distance btw cities, complex system of interconnection Vertices or edges. direction? Weight SUMMARY Arrays + direct indexing + easy to create and use !- sorting and searching - inserting and deleting, particularly in the middle !Linked Lists + inserting and deleting elements + iterating through the collection !- direct access - searching and sorting !Stacks and Queues + Designed for LIFO / FIFO !- direct access - search sort !Hash Tables + speed of insertion and deletion + speed of access !- overhead - retrieving in sorted order - searching for specific value !Sets + membership + avoid duplicates !- everything else !Binary Search Trees + speed of insertion and deletion + speed of access + maintain sorted order !- overhead !Heaps Fixed structures are faster/smaller. If speed and weight are a concern choose fixed as much as possible. Well, it might be worth your while to copy the mutable version into an immutable fixed size version of that data structure. Copy and change types. Try changing from one structure to another. See if it improves performance. !NoSQL Databases DOCUMENT STORE self-contained document, not rows/columns XML, JSON very loose, no schema, flexibility. Like MongoDB, CouchDB
  • 6.
    !KEY-VALUE again nopredefined schema. whatever you want in either category GRAPH DATABASE very inter relational like Neo4j !XML nested ORM object relational mapping. Like ActiveRecord (Ruby), Hibernate (Java) ! ! DEEP DEVELOPMENT’S HANDSOME HELPING FROM TEAM ACTIVITY One does not merely walk in Data Structures. Not with 10,000 men could you do that. Therefore, the UX and the UI has to be considered. Moreover, the same, or at least similar methodologies can be used to help make more nuanced and modularized decisions about what to do with data, whether to process on client-side or server-side, distributed systems and load, etc. At this point, it may come as little surprise that the benefits of team cohesion and activities make deep development and data decisions more contextual. But the side benefit of being able to articulate WHY they are ordering from the Tapas Menu, mixing and matching, as opposed from the Big Plates, is a timely one. Americans are struggling with obesity. And so are their servers. It’s a teachable moment, as they say. Because there is common ground, even the most technical blah blah blah can become a real two-way conversation. And that is going to benefit not only out team, but it is something tasty we can serve up to the larger company culture. Other groups may enjoy the fruits of our labor. Bon Appétit! ! !