CS data structures

studied byStudied by 2 people
5.0(1)
Get a hint
Hint

1 / 53

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

54 Terms

1
New cards
2

Selection Sort

Selects the largest or smallest element to swap with.

New cards
3

Insertion sort

Inserts the first unsorted element to the front.

New cards
4

Bubble sort

The largest or smallest element bubbles up

New cards
5

Merge sort

Splits the data set in half and merge in order with the auxillary arrays

New cards
6

Quick sort

Makes an element a pivot and sorts it based on it.

New cards
7

Radix sort

Sorts based on the element’s length and content

New cards
8

Heap sort

Maximum or minim numbers get sorted as highest priority

New cards
9

Time complexity for Selection sort

Best case: O(n^2)

Average: O(n^2)

Worst case: O(n^2)

New cards
10

Time complexity for Insertion Sort

Best case: O(n)

Average: O(n^2)

Worst case: O(n^2)

New cards
11

Time complexity for Bubble Sort

Best case: O(n)

Average: O(n^2)

Worst case: O(n^2)

New cards
12

Time complexity for Merge sort

Best case: O(nlogn)

Average: O(nlogn)

Worst case: O(nlogn)

New cards
13

Time complexity for Quick sort

Best case: O(nlogn)

Average: O(nlogn)

Worst case: O(n^2)

New cards
14

Time complexity for Radix sort

Best case: O(n * k)

Average: O(n * k)

Worst case: O(n^2)

New cards
15

Time complexity for Heap sort

Best case: O(nlogn)

Average: O(nlogn)

Worst case: O(nlogn)

New cards
16

Linked List

A list of pointers pointing to each other in one way.

New cards
17

Stack

A linked list that goes with “First in, Last out”

New cards
18

Queue

A linked list that goes with “First in, First out”

New cards
19

Set

Unordered collection of elements

New cards
20

Hash table

An array of elements that are inserted based on their hash codes

New cards
21

Binary Search Tree

A data structure that has two children, left ones are smaller and right ones are larger

New cards
22

Maps

Data structure that associates a key with a value

New cards
23

Red-Black Tree

A self-balancing tree that utilizes color codes to balance itself

New cards
24

Node

Building block of a tree

New cards
25

Ancestor

Nodes above the current node

New cards
26

Descendant

Nodes below the current node

New cards
27

Child

A node that is below the current node and is linked left or right

New cards
28

Interior node

Node that is not a leaf

New cards
29

Parent

The previous linked node of the current node

New cards
30

Sibling

The node that is also a child of the current node

New cards
31

Root

Node with no parent

New cards
32

Time complexity for Linked List

Add: O(1), O(n) in middle

Remove: O(1), O(n) in middle

Search: O(n)

New cards
33

Time complexity for Stack

Add: O(1)

Remove: O(1)

Search: O(n)

New cards
34

Time complexity for Queue

Add: O(1)

Remove: O(1)

Search: O(n)

New cards
35

Time complexity for Hash table

Add: O(1)+

Remove: O(1)+

Search: O(1)

Iterate: O(n)

New cards
36

Time complexity for Binary Search Tree

Add: O(logn)/O(n)

Remove: O(logn)/O(n)

Search: O(logn)/O(n)

New cards
37

Time complexity for Heap

Add: O(nlogn)

Remove: O(nlogn)

Search: O(logn)

New cards
38

How much merges would be needed for an array of n length?

N - 1 merges

New cards
39

How many more times would you need to merge if you double the array size of n length?

1 more time

New cards
40

What search to use if you are only searching once?

Linear

New cards
41

What search process to use if you are searching multiple times in an unsorted data set?

Quick sort then binary sort

New cards
42

For insertion sort for sorted lists, if the time to sort 10 items is 4 seconds, the time for 30 items is

12 seconds

New cards
43

What is the Big Oh growth rate of 5000000n + 343242342?

O(n)

New cards
44

Linear search time complexity

O(n)

New cards
45

Binary search time complexity

O(nlogn)

New cards
46

What would be the best data structure to store blocked websites?

Set

New cards
47

Time efficiency to printing out all nodes of a Red-Black tree

O(n)

New cards
48

Time efficiency to printing out all nodes of a Red-Black tree

O(

New cards
49

Adding/removing from a stack/queue array time efficiency

O(1)+

New cards
50

Unordered sets/maps are more efficient than ordered ones

True

New cards
51

What does a good hash function do?

Reduce collisions and makes finding easy

New cards
52

Inorder traversal

Left, center, right

New cards
53

Pre-order traversal

Center, left, right

New cards
54

Post-order traversal

left, right, center

New cards

Explore top notes

note Note
studied byStudied by 64 people
... ago
4.9(7)
note Note
studied byStudied by 37 people
... ago
5.0(2)
note Note
studied byStudied by 521 people
... ago
4.5(2)
note Note
studied byStudied by 33 people
... ago
5.0(1)
note Note
studied byStudied by 20 people
... ago
5.0(1)
note Note
studied byStudied by 5 people
... ago
5.0(1)
note Note
studied byStudied by 22 people
... ago
4.5(2)

Explore top flashcards

flashcards Flashcard (44)
studied byStudied by 42 people
... ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 21 people
... ago
5.0(1)
flashcards Flashcard (83)
studied byStudied by 36 people
... ago
5.0(2)
flashcards Flashcard (42)
studied byStudied by 11 people
... ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 7 people
... ago
4.0(1)
flashcards Flashcard (60)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (39)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (67)
studied byStudied by 227 people
... ago
5.0(9)
robot