Please enable JavaScript.
Coggle requires JavaScript to display documents.
data structures and algorithms - Coggle Diagram
data structures and algorithms
definitions
datastructures are different ways of storing data on your computer
Algorithms are predations on different data structures and sets of instructions for executing them
recursion is a way of solving a problem by having a function call itself
Big ) notation
Time complexity
is a way of showing how the runtime of a function increases
types
linear time O(n)
constant time O(0)
quadratic time O(n^2)
data structures
array
let array = [1,2,3]
can set or find elements in an array by bracket notation ex... aray[0] = 1
classes and objects
classes help abstract objects, its like a template.
contains instance variables
this or self refers to the instance of a class in question
linked list
stores related items
adding an item does not require recreating the list in new memory space, rather they are tethered together
you can go from element to element in only the forward direction. you cannot look back
computer memory fundamentals
ram
short term memory
fast storage, easy and temporary
storage
long term storage
slow and takes a long time to access
bits = 1 or 0
any number can be expressed by some combination of 32 0s and 1ns
byte is a small unit of data = 8 bits ie: 10010101
math
factorials
n! = n*(n-1)!
only works if n >=1
function fact(n) { if (x===0) { return 1} else { return x * fact(n-1) }}
fibonachi sequence
the next number can be found by adding together the two previous numbers
function fib(n) { if (n >= 3 ) { return fib(n-1) + fib(n-2) }