As I explore the world of data structures and algorithms, it is only right that I document my understanding of tree structures by explaining the different ways to traverse a tree with iterative solutions
Trees are data structures that connect nodes in a parent-child relationship. Each parent node will have a pointer to their child node. This means that the parent will always know their child.
Binary Search Tree
A Binary Tree is a tree data structure in which each node has a least two children, which are referenced as the left and right child nodes. The consistency of…
As I continue my battle in learning how to solve algorithms for future technical interviews, I was recommended by a friend to schedule mock interviews on a site called Pramp!
Once you have signed up for Pramp, you receive 6 interview credits for you to you any time! You will also have the option to pick your language that you feel comfortable coding in along with what you would like to interview for. There is a nice variety of choices like Data structures and algorithms, Frontend, Data Science, and more.
Once you schedule your interview, you receive a confirmation email…
If you’re like me, practicing a code challenge is probably the one thing that’s got you feeling extremely nervous about that technical interview coming up soon, or even tomorrow! That’s okay, they are meant to be challenging, otherwise, they wouldn't be called code challenges!
Luckily, they are not impossible to solve, unless someone out there has created the world's most complicated algorithm — which would just be incredibly unnecessary.
Aside from all of the “what ifs”, I am here to talk about an algorithm I struggled solving!
There is a large pile of socks that must be paired by color…
For my final project for Module 5 at Flatiron, it was the day before our projects were due for presentations. Unfortunately, my project was not how I envisioned it to look or function. That was okay, I had already accepted that it wouldn't. Fortunately, I at least wanted to learn something that would make my application at least look a little more dynamic!
That’s when I learned about React Page Transitions! Framer Motion — An open-source react animation library for frontend design lovers. With Framer Motion, you can do animations like:
What does it mean to find the “maximum depth ” of a tree data structure?
Luckily, it is as simple as finding the last remaining french fry at the bottom of your bag! As stated by Leetcode, “A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.”
Continuing on from my latest blogs of learning about Tree and Graph data structures, I wanted to also write about the two ways to traverse these data structures using Breadth-First Search & Depth-First Search!
Depth-first search is an algorithm and searches or traverses through a graph or tree data structure. Starting at a selected root node (this can be any node of choice for a graph data structure), the algorithm explores along each possible branch it can find until it has to backtrack up from the explored node down to unvisited nodes.
Do you mean the graphs they teach you in school?
Well, if you mean the graphs they teach you in mathematics like a bar graph, not necessarily. I mean graphs in computer science terms.
“A graph data structure consists of a finite (and possibly mutable) set of vertices (also called nodes or points), together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph. These pairs are known as edges (also called links or lines), and for a directed graph are also known as arrows.” — Wikipedia
In computer programming, Recursion, or a Recursive function, is a function that calls itself!
A simple analogy to what recursion is would be if you owned a Russian stacking doll. There is the first doll that is large in size, however, when you open it up, there awaits another doll, just slightly smaller in size! You realize that you can open up that doll to reveal another one just like it, only slightly smaller! This is a continuous activity until you have come to the very last doll, which then breaks the cycle. This is a visual representation of recursion!
First, you’re probably wondering, “What Is Object-Oriented Programming?”, well according to Wikipedia —
“Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).”
Think of OOP as making breakfast! The properties for breakfast would be — eggs, flour, meat, water, coffee-grinds, etc. The methods along with it would be — makeCoffee(), preparePan(), and whiskEggs(). …
The best way to understand OOJS is that the objects in our code are what we use as models to represent the real world people, place, & things, to then plug those models into our program to solve real-world problems. Like our object, people contain “data”, and what I mean by that is, they have a name, age, sex, height, weight, occupation.. etc. OOJS gives us the ability to use the information from the model to emulate the behaviors and functionalities from that model, to then create data for us (programmers)to use in our application!