DS Flashcards

(16 cards)

1
Q

bubble sort

A

https://www.youtube.com/shorts/y2AghjB4Wxs

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

Selection sort

A

https://www.youtube.com/shorts/HRwi5gwlB0U

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

insertion sort

A

https://www.youtube.com/shorts/ZZ-Oz1IFfPg

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

Quick sort

A

https://www.youtube.com/shorts/MeBYqiehwyQ

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

System vs User defined datatypes

A

system -
all primitive types
Collection - List Set Map
class - Scanner, Random, LocalDate
String
Arrays

user -
1. Class
2. Interfaces
3. Enum
4. Records
5. Custom Wrapper Classes

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

Primitive vs non primitive

A

Primitive :
byte, short, int, long
float, double
char
boolean

Non-Primitive:
Strings
Arrays
Classes
Interface
Enum
Collection - List Set Map

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

Linear vs non linear

A

Linear
linked list
stack queue

Non linear
tree
graph
queue

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

Abstract data type

A

List, Stack, Queue, Dequeue, Priority Queue, Set, Map

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

Big-O

A

Big-O Name Example Algorithm
O(1) Constant Accessing an array element (arr[i])
O(log n) Logarithmic Binary Search
O(n) Linear Linear Search
O(n log n) Linearithmic Merge Sort, Quick Sort (average case)
O(n²) Quadratic Bubble Sort, Insertion Sort
O(2ⁿ) Exponential Recursion in Fibonacci (naive)
O(n!) Factorial Traveling Salesman Problem (TSP)

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

Notation for time complexity

A

omega - best case
Big O - worst case

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

Hash

A

hash function changes a key to an integer and helps in storing values
if more than one value falls in same key, it is stored as link list

Operation Average Case Worst Case

Insertion O(1) O(n) (all values in one bucket)
Search O(1) O(n) (in case of many collisions)
Deletion O(1) O(n)

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

to get ascii value in js

A

“ABC”.charCodeAt(0)

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

StringBuilder

A

mutable
allocates dynamic data space and multi thread allowed

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

StringBuffer

A

same as StringBuilder but only one thread is allowed

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

Java default queue syntax

A

Queue<Integer> q = new LinkedList<>();</Integer>

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

greedy algorithm

A

​A greedy algorithm is a problem-solving approach that makes the optimal choice at each step with the hope of finding the global optimum. It selects the best option available at the moment without considering the broader consequences of that choice.​