Main Flashcards

1
Q

Frequency Counter

A

Uses objects or sets to compare values or frequency of values. (Ex: Check if two strings are anagrams of one another.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The difference between justify-content: space-between and justify-content: space-around

A

space-between aligns items with an even space between them while space-around does the same thing, but with a half space added on each end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The difference between justify-content and align-items

A

justify-content aligns items on the horizontal axis and align items on the cross (vertical) axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does flex-direction column affect justify-content and align-item?

A

Flex-direction: column causes justify-content to align items vertically and align-items to align items horizontally. (Opposite of their normal behavior)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The difference between align-items and align-content

A

align-content determines the spacing between lines, while align-items determines how the items as a whole are aligned within the container.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Server Side Rendering

A

Server-side rendering (SSR) is an application’s ability to convert HTML files on the server into a fully rendered HTML page for the client. The web browser submits a request for information from the server, which instantly responds by sending a fully rendered page to the client.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Client Side Rendering

A

With a client-side rendering solution, you redirect the request to a single HTML file and the server will deliver it without any content (or with a loading screen) until you fetch all the JavaScript and let the browser compile everything before rendering the content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linear Search

A

Searches through a set of data (i.e. an array) one element at a time.

Time Complexity O(n).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Binary Search

A

Searches through an ordered data set (i.e. an array of numbers in ascending order) by finding a midpoint between the start and end of a data set, then removing half the set on each iteration. (I.e. if looking for a number and array[midpoint] is greater than that value, move the start to midpoint and find a new midpoint, effectively removing the first half of the array from the search).

Time Complexity: O(log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Bubble Sort

A

A sorting algorithm where the largest values “bubble up” to the top. (i.e. end of the array). Iterates through array and checks each two value pair to see which is greater, then swaps them if necessary. Can be optimized by tracking swaps and breaking loop if no swaps are made during an iteration.

Time Complexity: O(n^2), unless optimized and array is nearly sorted, in which case it’s O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Selection Sort

A

The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array.

1) The subarray which is already sorted.
2) Remaining subarray which is unsorted.

Time Complexity: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Insertion Sort

A

Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.

Time Complexity: O(n^2), but can be more like O(n) if array is nearly sorted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Merge Sort

A

A sorting algorithm that uses a divide & conquer strategy to recursively halve an array into 1 or 0 element long arrays, then merges each each half (series of halves) back into a sorted array

Time Complexity: O(n log n), Space Complexity: O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Asymptote

A

A line that continually approaches a given curve but does not meet it at any finite distance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Tree

A

In computer science, a tree is a widely used abstract data type that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Binary Tree

A

A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Binary Search Tree

A

Binary Search Tree is a node-based binary tree data structure which has the following properties:

The left subtree of a node contains only nodes with keys lesser than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Stack

A

Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Queue

A

A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Stack vs Queue

A

The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.

21
Q

Breadth First Search

A

Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a given property. It starts at the tree root and explores all nodes at the present depth prior to moving on to the nodes at the next depth level. Extra memory, usually a queue, is needed to keep track of the child nodes that were encountered but not yet explored.

22
Q

Depth First Search

A

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking.

23
Q

Binary Heap

A

A Binary Heap is a Binary Tree with following properties.

1) It’s a complete tree (All levels are completely filled except possibly the last level and the last level has all keys as left as possible). This property of Binary Heap makes them suitable to be stored in an array.
2) A Binary Heap is either Min Heap or Max Heap. In a Min Binary Heap, the key at root must be minimum among all keys present in Binary Heap. The same property must be recursively true for all nodes in Binary Tree. Max Binary Heap is similar to MinHeap.

24
Q

Hash Table

A

Hashing is a technique or process of mapping keys, values into the hash table by using a hash function. It is done for faster access to elements. The efficiency of mapping depends on the efficiency of the hash function used.

On average:
Insertion: O(1)
Deletion: O(1)
Access: O(1)

25
Q

Separate Chaining

A

Method for handling collisions in a hash table. Each element of hash table stores another nested data structure, such as an array or linked list.

26
Q

Linear Probing

A

Method for handling collisions in a hash table. When a collision occurs, the colliding element is placed in the next empty slot. (Can look forwards or backwards). Max one element per slot.

27
Q

Graph

A

A collection of vertices (nodes) and connections (edges)

28
Q

Vertex

A

Node in a graph

29
Q

Edge

A

Connection between vertices in a graph

30
Q

Undirected Graph vs Directed Graph

A

All edges in an undirected graph go both ways. In a directed graph, some edges may go both ways, while others go only one way. Edges are assigned specific directions.

31
Q

Weighted Graph

A

A graph where edges are assigned values.

32
Q

Adjacency Matrix vs Adjacency List

A

An adjacency matrix stores every possible edge between vertices and whether that edge exists or does not. An adjacency list stores only the existing edges for each vertex. AM takes more space and is slow to iterate over, but is fast for finding specific edges. AL takes less space and is faster to iterate over, but is slower for finding specific edges.

33
Q

Open-Closed Principled

A

In object-oriented programming, the open–closed principle states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”

34
Q

Encapsulation

A

Encapsulation is one of the fundamentals of OOP (object-oriented programming). It refers to the bundling of data with the methods that operate on that data. Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties’ direct access to them. Publicly accessible methods are generally provided in the class (so-called getters and setters) to access the values, and other client classes call these methods to retrieve and modify the values within the object.[1]

35
Q

Abstraction

A

Abstraction is the concept of object-oriented programming that “shows” only essential attributes and “hides” unnecessary information. The main purpose of abstraction is hiding the unnecessary details from the users.

36
Q

Inheritance

A

Inheritance is one of the core concepts of object-oriented programming (OOP) languages. It is a mechanism where you can to derive a class from another class for a hierarchy of classes that share a set of attributes and methods.

37
Q

Polymorphism

A

Polymorphism describes a pattern in object oriented programming in which classes have different functionality while sharing a common interface.

The beauty of polymorphism is that the code working with the different classes does not need to know which class it is using since they’re all used the same way. A real world analogy for polymorphism is a button. Everyone knows how to use a button: you simply apply pressure to it. What a button “does,” however, depends on what it is connected to and the context in which it is used — but the result does not affect how it is used. If your boss tells you to press a button, you already have all the information needed to perform the task.

In the programming world, polymorphism is used to make applications more modular and extensible. Instead of messy conditional statements describing different courses of action, you create interchangeable objects that you select based on your needs. That is the basic goal of polymorphism.

38
Q

Factory Function vs Constructor Function

A

A constructor returns an instance of the class you call it on. A factory function can return anything. You would use a factory function when you need to return arbitrary values or when a class has a large setup process.

https://bit.ly/34KE9Ys

39
Q

new operator

A

the new operator in JavaScript is used to create new object instances. It binds the ‘this’ of the new object to itself.

40
Q

call()

A

The call() method calls a function with a given this value and arguments provided individually.

41
Q

bind()

A

The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.

42
Q

apply()

A

The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).

43
Q

Primitives

A
number
string
boolean
undefined
null
symbol
44
Q

Reference Values

A

anything that is “typeof” “object”
objects
arrays
functions

45
Q

Primitives vs Reference Values

A

Primitives store an individual value. References store a reference to a place in memory.

let x = 10;
let y = x;
x = 20;
console.log(y); // 10
let x = { value: 10 };
let y = x;
x.value = 20;
console.log(y); // { value: 20 }
46
Q

Scope vs Closure

A

When you declare a variable in a function, you can only access it in the function. These variables are said to be scoped to the function.

If you define any inner function within another function, this inner function is called a closure. It retains access to the variables created in the outer function.

47
Q

Function vs Method

A

Function is a set of logic that can be used to manipulate data. While, Method is function that is used to manipulate the data of the object where it belongs.

48
Q

Constructor Pattern

A

A class-based pattern that uses the constructors present in the class to create specific types of objects.

https://www.educative.io/collection/page/5429798910296064/5725579815944192/5920633608208384