Leon Noel

Interview Secrets
#100Devs
"I just popped a bean and I'm on a helicopter
I don’t wanna do shit, unless I'm with my partners"
Agenda
-
Questions?
-
Discuss - THE TEA
-
Submission - Homework?
-
Review - How To Learn
-
Learn - What are DS and Algorithms
-
Learn - Key Data Structures
-
Homework - Challenge Questions and Algo Reading

"It's really just about reaching your full LSC"
Questions
About class or life

Congrats Sam
12 / 100

Congrats OCC

Microsoft
Sponsored Stream
THURSDAY & FRIDAY

The Tea Spillith



Portfolio, Twitter, Linkedin

"Just had a coffee chat was told they see so many applicants with empty githubs, no portfolio sites and no projects under their belt
We’re on the right track yall, Leon has definitely given us the cheat codes"
@Telescope_Thieves
Github
PUSH EVERY DAY

Recruiters Love Green Squares

10 Premium Apps
Custom everything plus, tweets, blog, and project
P.R.E.P
Parameters, Returns, Examples, Pseudo Code
Methods Questions
Brute Force
Data Structures & Algorithms
Learning How To Learn
ACTIVE RECALL
SPACED REPETITION
Active Recall

Ali Abdaal: https://youtu.be/ukLnPbIffxE
Forgetting Curve*

https://intelalearning.wordpress.com
Resetting Forgetting Curve

https://www.pearsoned.com/three-simple-research-based-ways-to-ace-a-test
Data Structures &
Algorithms
An algorithm is just
the steps you take to solve a problem
An algorithm is just a function
This function transforms a certain input aka data structure
Into a certain output aka another data structure
The function contains logic that decides the transformation of the input to output
Your inputs and outputs should be defined. This is a great use case for unit tests
Think of a library
A library contains many data structures
-
Books
-
Magazines
-
CDs
-
DVDs
-
Blu-rays
If your data is a bunch of text, it makes sense to use a book to hold it.
If your data is a bunch of low quality video, it makes sense to use a dvd to hold it.
DVDs have a limit on the amount of data they can hold. Cheaper but constrained
Blu-rays can hold more data, but they cost more
When worrying about real data, it is also cost, but in space and time
Think of a linked vs. doubly linked list


Less Memory, but Less Efficient
More Memory, but More Efficient
To make good decisions as engineers we need to understand the different structures for our data
Back to the library

The best data structures consume minimal resources while storing data in a meaningful way for various operations
Flip Book vs. DVD
What if we want a specific book?
Data Structure
in equals string
Data Structure
out equals book

AKA our:
ALGORITHM
Do you check every book?
How much time does it take to move through each book?
Do you have to remember all the rows you already checked?
Question:
What would be the most efficient way to find the book?
How long it takes to find the book is our
Time Complexity
Thinking through the appropriate data structures and algorithms is how we can efficiently solve problems
When taking about the effecientness or complexity of a solution we can use
Big-O Notation
Big-O notation mathematically describes the complexity of an algorithm in terms of time and space
Common Complexities

O(1)
For all inputs to our algorithm there is and will always be only one operation required
- Order 1
- Constant Time
O(1) Example
No matter how many inputs are located in num there will only ever be one operation needed!
const nums = [1,2,3,4,5]
const firstNumber = nums[0]O(N)
For all inputs to our algorithm there will be one
operation per input
- Order n
- Linear
- Linear Scailing
O(N) Example
Here we sum the numbers in the array. We have to add each number to a running sum, so we have to operate on each one. This means one operation per input.
const nums = [1,2,3,4,5]
let sum = 0
for(let num of nums){
sum += num
}O(1) VS O(N)
Summing function for a sorted, contiguous array of integers that starts with the number 1? Could easily be O(n) but...
const sumContiguousArray = function(ary){
//get the last item
const lastItem = ary[ary.length - 1]
//Gauss's trick
return lastItem * (listItem + 1) / 2
}
const nums = [1,2,3,4,5]
const sumOfArray = sumContiguousArray(nums)Committing these to memory is important
O(N^2)
Order N Squared
Text
const hasDuplicates = function(num){
for(let i = 0; i < nums.length; i++){
const thisNum = nums[i]
for(let j = 0; j < nums.length; j++){
if(j !== i){
const otherNum = nums[j]
}
}
if(otherNum === thisNum) return true
}
return false
}
const nums = [1,2,3,4,5,5]
hasDuplicates(nums) //trueO(N^2)
Here we’re iterating over our array, which we already know is O(n), and another iteration inside it, which is another O(n). For every item in our list, we have to loop our list again to calculate what we need.
O(LOG N)
Logarithmic Time
Divide and Conquer?
Time to build the toolbox

Data Structures
Advantages
Disadvantages
When To Use
Example
-
Linked List
-
Doubly Linked List
-
Queue
-
Stack
-
Hash Table (Map)
-
Heap (min)
-
Heap (max)
-
Tree
-
Graph
Homework

#100devs - Interview Secrets
By Leon Noel
#100devs - Interview Secrets
Class 50 of our Free Web Dev Bootcamp for folx affected by the pandemic. Join live T/Th 6:30pm ET leonnoel.com/twitch and ask questions here: leonnoel.com/discord
- 838