Image for post
Image for post

What is sorting?

Sorting is rearranging a set of data into a specific order such as ascending to descending for numbers, or vice versa. A sorting algorithm takes in a given array or list and outputs a sorted array or list.

Sorting is applied everywhere. When we are on a website and sorting listings by lowest price to highest, ratings, etc. or searching for a book at the library. The concept of sorting makes it easier to arrange sets of data, therefore making it easier to search.

Types of Sorting Algorithms

There are many types of sorting algorithms. Sorting techniques are mainly differentiated by time complexity and space complexity. As the name implies, time complexity is the amount of time an algorithm takes to run as a function of the input length and space complexity is the amount of space or memory required as a function of input length. …

Image for post
Image for post

What is a binary tree?

A binary tree is a tree data structure which each node has at most two children. The children are referred to as the left child and the right child. The top most node in the tree is referred to as the root node.

A tree is a collections of node(s). Nodes are connected by edges. Each node contains a value and it may or may not have a child node.

What is traversing a tree?

Traversing a tree is the process of visiting each node in the tree exactly once. There are 2 widely known techniques for traversing trees are:

  • DFS or Depth First Search
  • BFS or Breadth First Search — Level Order…

Image for post
Image for post

What is a Power Set?

A Power Set is a set of all the subsets of a set, including the empty set and the set itself. A Set in JavaScript is a collection of values. A value in the Set may only occur once (no value is repeated); it is unique in the Set’s collection. With a given set, a power set are all the different ways we can select the values, including selecting none or all. The Power Set solution must not contain duplicate subsets.

For a set {a, b, c}, the following lists the power set of this set.

Image for post
Image for post
Photo by Maksym Kaharlytskyi on Unsplash

Asynchronous Operation — Why do we care?

JavaScript is a synchronous, blocking, single threaded language. Synchronous single threaded means JavaScript waits for the task to be completed before being able to move on to the next task. However, Asynchronous JavaScript makes it so much faster if each task takes a really long time! Instead of waiting for the task beforehand to move on, there can be independent threads to start the tasks simultaneously.

Image for post
Image for post

What is a Linked List?

A linked list is a data structure made up of a chain of nodes connected by links. Each node contains a value and has a next pointer to the next node in the chain. The head pointer points to the first node and the last element points to null.

There are different types of linked lists:

  • Singly Linked List (uni-directional)
  • Doubly Linked List (bi-directional)
  • Circular Linked List

Linked lists have simple basic operations such as insertion, deletion, search. Unlike arrays, the pointers in the elements can be changed easily to insert or delete an element.

What is a palindrome?

Image for post
Image for post

What is React?

React is a JavaScript library for building user interfaces. React was developed by Facebook and Instagram. React deals with View in MVC (Model — View — Controller). React is declarative, rather than imperative. Declarative code (such as HTML) is a programming paradigm that expresses what to do without describing the how to.

Why React?

React give you tools for interacting with the DOM that are much cleaner and effective than with raw JavaScript or jQuery. The HTML, CSS, JavaScript can be held in one component, they are like “super powered” HTML tags. It is fast and supports code modularity and reuse.

React Concepts

There are many react concepts that all serve importance. To keep this post, concise and sweet we will discuss the basic foundational ones listed. …

Image for post
Image for post
Photo by Honey Yanibel Minaya Cruz on Unsplash

Given an n x n matrix, how can we rotate it by 90 degrees clockwise? This is a standard algorithm problem, let’s look at a straightforward solution with visuals before we refactor and optimize our code.

Our goal is to write a function that accepts an input matrix of any n x n size and returns an output of a rotated matrix. See the example of a 3 x 3 matrix below, an array of arrays representation for our input and output.

This blog will cover the following and use a 3 x 3 matrix example:

  1. Visuals for each step of the matrix rotation…

Image for post
Image for post
Photo by niko photos on Unsplash

The ability to traverse a tree is an important basic foundational concept. A tree is a data structure with a collection of nodes with a hierarchical pattern. Each node is its own data structure. A tree’s structure has a single ‘root’ node and each node has a value and a reference pointing to its children nodes.

Image for post
Image for post
Photo by Joshua Sortino on Unsplash

In computer science, a data structure is a way to store and organize your data so you can access or operate on this information effectively. Hash Table is a type of data structure. In other languages, they can be referred to as dictionary, hash map or map. Hash tables are useful to do quick looks ups on a set of data. They are a quick way to implement mappings of key value pairs.

Sound familiar? JavaScript Objects! Under the hood, objects are constructed by hash tables essentially.

From a high overview, hash table consists of:

  • Data (key values) to be stored and then accessed when given the…

Image for post
Image for post
Photo by Alex Kotliarskyi on Unsplash

In Object Oriented Programming (OOP), there are different patterns to instantiate (which means to ‘create a new instance of’) objects. I like to think of it as a factory or system that is creating objects and these objects have data stored and functions available to them. There isn’t a correct instantiation pattern to implement for all scenarios. Each pattern of instantiation has its own benefits and disadvantages which will allow you to determine which pattern would result in a better solution. The JS instantiation patterns are:

  • Functional
  • Functional Shared
  • Prototypal
  • Pseudoclassical
  • ES6 Class

A popular convention in JavaScript is for the first letter of a constructor to be capitalized. …


Tina Luk

Mommy and student figuring things out

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store