Wednesday, February 22, 2017

10 Programming Data Structures and Algorithms - in Pictures

I've been studying

...I know, doesn't sound that interesting, right? Well, I noticed that, while studying, I started drawing "icons" to remind myself how each concept works---and to do so quickly

(Plus, I just find sketches more interesting to look at than text anyways.)

There are a lot of data structures and algorithms out there, some of which I just need to brush up on, others are entirely new to me. It's easy to lose track of the important details when there's a lot to catch up on.

I personally find it much easier to quickly scan a visual than to read the same thing in text. So with my "icons", I don't have to re-read the walls of text in my notes (and potentially forget details when I need to code on the spot). Maybe you might find these pictures helpful for review, or as a starting point.

The idea is similar to the visual memory-aids I made for an earlier post on learning more efficiently. Deeply learning and connecting concepts can help make memories more robust.

As a final thought, you might find it helpful to also use the method of loci, to keep track of all the concepts under one roof in your mind (with some branching to group details together to each concept). 

For example, my living room couch is my "location" for the hash table. From there it's easy to visualize the insert, delete, search, and rehash functions---using the pillows. Different parts of that couch also serve as reminders of member variables, etc.


Not actually my couch(es). Image from Wikipedia.

Now, without further ado, here are "icons" that serve as visual summaries for ten computer science concepts. Enjoy! 

Search Algorithms:

 

#1. Interpolation Search:

 

#2. Binary Search:


-------
-------
-------

Sorting Algorithms:

 

#3. Insertion Sort:

 

#4. Shell Sort:

 

#5. Quick Sort:

 

#6. Merge Sort:


-------
-------
-------

Data Structures:


-------

Stack:

#7. Stack - Array Implementation:

 

#8. Stack - Linked List Implementation:


-------
 

Queue:

 

#9. Queue - Array Implementation: 

 

#10. Queue - Linked List Implementation:

_________________________

LINKS TO OTHER STUFF: 


Chinese Learning Projects:
 - Book
 - HSK 1
 - HSK 5

Wednesday, November 16, 2016

Learning Faster and Memory Structures


Make effective connections.

Prologue:

Learning Faster

The idea is this:  the more effectively you use your time to learn something, the less time you have to spend on reviewing it (i.e. "reviewing" what you thought you knew in the first place).  Here are four steps in the "Feynman Technique" (based on a post from Medium) that could help you more effectively learn an idea that is new to you:

Step 1:  Teach it [as if] to a child.
Step 2:  Review.
Step 3:  Organize and Simplify.
Step 4 (optional):  Transmit.

I personally would addTest it.  Apply it. 

And based on a post from LinkedIn:  
When you learn something, check that you can actually do a few things. 
C
an you...:  Understand it? 
Explain itRemember it so you can use it later? 
...Use it in real life? 

_________________________

Now here's all of the above info, re-digested and re-combined into pictures:

Step 1: Link "New" Idea to "Old" Idea
Step 1Take a new idea (usually an abstract idea, or at least an idea that's "new" to you) and link it to an "old" idea (something concrete and/or that you personally understand well already).  There's at least three ways to do this.  You could directly relate the new idea to something you learned earlier (if that idea was well understood in the first place).  Or you could substitute the new idea with a more concrete one by using an analogy or metaphor.  Or you could (try to) put the new idea into simpler words while still capturing the same meaning (just trying to do this can help test how well you understand something, as if you were trying to explain something to a very young child.)
Step 2: Make a Cohesive "Story" out of the Ideas
Step 2This builds on step 1Connect the new ideas together into one "story", like how different ideas in a textbook can build on each otherLike how different pieces of a puzzle can be put together to tell a bigger story.  Like how different parts of an assembly line contribute to the final product.  Like how different moves in a game help you to win.  Like parts of an organism or a chemical pathway or a movie or a song.  It should flow naturally as if it were one story.
Step 3: "Tell" your "Story" to Someone Else
Step 3:  Tell your "story" to someone else.  Actually try to explain the ideas to someone else.  Or pretend to explain it to someone (ever heard of "rubber ducking"?).  Either way, this can help make sure you know the ideas well enough by forcing yourself to organize your ideas so that someone else can understandPreferably find a beginner who doesn't already know the subject.  And see if they can explain it back to you---in their own words.
Step 4: Use it and Test it
Step 4:  Test it.  This is another way to check for gaps in your understanding.  Actually see if your explanations are helpful when the ideas are used in real-life.  Don't just feel satisfied that people like your explanation or that they can tell it back to you in their own words.  The ultimate test is to use what you know and understand, to do something with it.  And isn't that why you're learning it in the first place?

_________________________

Epilogue:

Memory Structures 

The structures in those pictures are quite similar to the structure of some mnemonic techniques (i.e. similar to the structures of different ways to help yourself remember things).

Visually, they remind me of machine learning and neural network connections, but also can serve as "schematics" for memory and understanding.

The table below shows my visualizations of five memory techniques I've seen before (link, sub, story, peg, loci)*, plus one "new" visual I've thought up for remembering branching information (I don't really know what to call it besides "branching memory structure").

Visuals Examples Example Uses
Link
A grocery list (milk, apples, and cash) can become a ridiculous but memorable mental image that can be described as "a cow made of apples eating grass made of money---so money doesn't grow on trees". For lists of visualizable items. Or for "attaching" reminders to objects you'll see in your home or surroundings.
Substitution
The state of Kentucky becomes "KFC food". Or "nihao" becomes "knee how" (homophones). Or conifer tree becomes your friend Khan or Connie is suddenly made of cones (head partial homophones). Or Nevada becomes a "new Vader". For remembering definitions or translations by turning abstract words into visualizable or concrete items.  The free website Memrise "automates" this with crowd-sourced memory aids for vocabulary.
Story
= Substitution + Link For a list of abstract words that are new to you.
Pegs
Make use of how numbers and letters have built-in order. "One" rhymes with "sun", two with shoe, three with tree. Or A is for Aladdin, B is for Batman, C is for Cookie monster. You then use the link method to attach items to the visuals already associated to each number/letter peg. Example: Aladdin drinking milk, Batman slicing apples, Cookie monster eating cookies shaped like money. For longer lists where the order might matter. You can still recall and test yourself on items out of order once you establish your own pegs. Also for main ideas of a script, book, presentation, etc.
Loci / Journey / Mind Palace
Similar to the pegs method, but instead uses spatial memory pegs that are real-life permanent items in a room you're familiar with, and those items numbered clockwise around the room, and extending to other rooms in your house. Example in my room: 1=window, 2=bed, 3=shelf. --> Milk splat on the window, pile of apples on the bed, cash exploding out from books on the shelf. For even longer listsFor the main ideas in a script, book, presentation, etc.  You recall or practice by mentally "walking" through the numbered path in your house.
(Branching memory structure)
Example: broadleaf trees can be divided into opposite-branching and alternate-branching leaves. This can be visualized as a brood Zerg having opposing claws and a tail that wags alternately back and forth. Further sub-divisions among opposite-branching trees are visualized by that opposing brood Zerg claw scratching Optimus Prime, who has a hand holding a SIMS character (simple leaf) and has a foot kicking a compound inmate (compound leaf). For branching information, like in tree identification.

 (If you can think of a better name for the last one, let me know!)

Final thoughts:
Without scrolling up, are you able draw down on paper one thing you've just learned? 
Choose just one idea and try putting it to use.

_________________________
* You can see more examples and details at:  

Lorayne, Harry, and Jerry Lucas. The memory book: The classic guide to improving your memory at work, at school, and at play. Ballantine Books, 2012.

And for a 7-minute video on Sherlock's Mind Palace: 
https://www.youtube.com/watch?v=3vlpQHJ09do

_________________________


LINKS TO OTHER STUFF: 

Favourites
Programming
Original Art
Games

Monday, September 26, 2016

How to Convert Temperature Quickly in Your Head - Animated



Exact: Easier: Error:
C = (F-32) × 5÷9 C = F÷2 + (F÷2)÷10 - 18* Within 1 degree + 1% of F.
F = C × 9÷5 + 32 F = C×2 - (C×2)÷10 + 32 0
* - 18 = - 20 + 2



Animated CALCULATOR:




Original post: 
hchiam.blogspot.ca/2015/12/how-to-convert-temperature-f-c-quickly.html


GitHub code: 
github.com/hchiam/embeddedWebApps 

_________________________

LINKS TO OTHER STUFF: 

Favourites
Programming
Original Art
Games