fundamentals of algorithm

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/131

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

132 Terms

1
New cards
<p>what does this denote&nbsp;</p>

what does this denote 

Denotes a set of elements

2
New cards
<p>what does this symbol denote</p>

what does this symbol denote

empty set

3
New cards
<p>what does this symbol denote&nbsp;</p>

what does this symbol denote 

variable or value is an element of a given set 

4
New cards
<p>what does this symbol denote</p>

what does this symbol denote

variable or value is not a element of a given set

5
New cards
<p>what does &nbsp;this subset symbol denote&nbsp;</p>

what does  this subset symbol denote 

variable is a subset of a given set 

6
New cards
<p>what does &nbsp;this subset symbol denote&nbsp;</p>

what does  this subset symbol denote 

variable is a proper subset of a given set

7
New cards

what does (x,y) denote

a pair of values

8
New cards

what does this symbol denote |x|

size of a given set or list x

9
New cards

what does this symbol denote y[I]

ith element of a given list where I = 0,1, |y|-1

10
New cards
<p>what does this symbol denote </p>

what does this symbol denote

floor value of a given value or variable

11
New cards
<p>what does the ceiling symbol denote </p>

what does the ceiling symbol denote

ceiling value of a given variable or value 

12
New cards

what does mod or % denote

modulo

13
New cards

what is the definition of alphabet Σ

finite non empty set whose elements are called letters 

14
New cards

when is string y a factor of string x

when two strings exist

15
New cards
<p>what is the Lexicographic order </p>

what is the Lexicographic order

strings induced by an order of letters and denoted by the same symbol

16
New cards

log(a) + log(b)

log(ab)

17
New cards

log(a) - log(b)

log(a/b)

18
New cards

log(n^k)

k log(n)

19
New cards

log(2^n)

n

20
New cards

2^log(n)

n

21
New cards
<p>what does the function rule do </p>

what does the function rule do

assigns each element of x to one element of y

22
New cards

what does space complexity change depend on

input and data structures used and size of output

23
New cards

what does pseudocode provide 

general description of the algorithm

24
New cards

input and output algorithm

knowt flashcard image
25
New cards

Assignment algorithm

knowt flashcard image
26
New cards

if statement algorithm

knowt flashcard image
27
New cards

for loop algorithm

knowt flashcard image
28
New cards

while loop algorithm

<p></p>
29
New cards
<p>what does Big O denote </p>

what does Big O denote

the upper bound of the algorithm

30
New cards
<p>what does big Ω (omega) denote </p>

what does big Ω (omega) denote

lower bound of the algorithm

31
New cards

what does big Θ denote

tight bound of an algorithm

32
New cards
<p>O(1) Constant time</p>

O(1) Constant time

operation takes the same amount of time regardless of input size 

33
New cards

O(log(n)) Logarithmic time

time grows with logarithmically with input size

34
New cards

O(n) Linear time

Time grows proportionately to input size

35
New cards

O(n log(n)) Quasilinear time

Time grows slightly faster than linear 

36
New cards

O(n2) Quadratic time

time grows quadratically with input size  

37
New cards

O(n3) Cubic time

time grows cubically with input size

38
New cards

O(2n) Exponential time

Time grows exponentially with input size

39
New cards

what is a P (Polynomial) problem

time complexity can be expressed as O(n^k)

40
New cards

what is the NP (Non-deterministic Polynomial) problem

if a solution exist its correctness can be verified in polynomial time

41
New cards

when is a problem considered NP-Hard

NP problems can be reduced to its polynomial time

42
New cards

NP-Complete

both NP and NP hard

43
New cards
<p>Array </p>

Array

sequenced collection of variable of the same type

44
New cards
<p>equals(A,B)&nbsp;</p>

equals(A,B) 

Return true if the array A and B are equal 

45
New cards
<p>fill(A, x)</p>

fill(A, x)

stores the value x in every cell of array x

46
New cards
<p>copyOf(A, n)</p>

copyOf(A, n)

returns array size of n such that the first k element of this array are copied from A

47
New cards
<p>toString(A)</p>

toString(A)

Returns string representation of the Array A

48
New cards
<p>sort(A)</p>

sort(A)

Sorts array based on natural ordering of its elements

49
New cards
<p>binarySearch(A, x)</p>

binarySearch(A, x)

search the sorted array for value x returning index where its found

50
New cards

Stack

collection of objects of the same type which are inserted and removed

51
New cards
<p>push(e)</p>

push(e)

adds element e to the top of the stack

52
New cards
<p>pop()</p>

pop()

removes and returns the top element of the stack 

53
New cards
<p>top()</p>

top()

returns top element of stack without removing it

54
New cards
<p>size() </p>

size()

returns number of elements in the stack

55
New cards
<p>isEmpty()</p>

isEmpty()

returns a boolean indicating weather a stack is empty

56
New cards
<p>queue </p>

queue

collection of objects that are inserted and removed

57
New cards
<p>enqueue(e)</p>

enqueue(e)

add element e to back of the queue

58
New cards
<p>dequeue() </p>

dequeue()

removes and returns the first element in the queue

59
New cards
<p>first()</p>

first()

returns the first element of the queue without removing it

60
New cards
<p>size() </p>

size()

return the number of elements in the queue

61
New cards
<p>isEmpty()</p>

isEmpty()

returns a boolean indicating wether the queue is empty

62
New cards
<p>list </p>

list

linear sequence of elements where it can be added or removed

63
New cards

size() (Array lists)

Returns the number of elements in their list

64
New cards

 isEmpty() (Array List) 

Returns a boolean indicating weather a list is empty 

65
New cards

get(i) (Array List)

Returns the element of the list having index I

66
New cards

set(i, e)  (Array List)

Replaces element at index I with e returns old element which was replaced 

67
New cards

add(i, e) (Array List)

inserting element e into list moving all elements one index later

68
New cards

remove(i) (Array List)

Removes and returns all the elements at index I

69
New cards
<p>Singly linked list&nbsp;</p>

Singly linked list 

collection of nodes which form a linear sequence 

70
New cards

doubly linked list

node stores a reference the next and previous node

71
New cards

addFirst(e) (LinkedList Method)

insert the specified element at the beginning of the list

72
New cards

addLast(e) (LinkedList Method)

insert the specified element at the end of the list

73
New cards

getFirst() (LinkedList Method)

Returns the first element in the list

74
New cards

getLast() (LinkedList Method)

Returns the last element in the list

75
New cards

removeFirst()   (LinkedList Method)

Removes and returns the first element from the list 

76
New cards

removeLast() (LinkedList Method)

Removes and returns the last element from the list 

77
New cards

set(I,e) (LinkedList Method)

replaces the element I with index e and replaced element

78
New cards
<p>hash map </p>

hash map

stores data in the form of keys where value pair are denoted as k and v

79
New cards

hash function h(k)

take key k and compute an integer

80
New cards

when will a collision happen

k1 = k2

81
New cards

what does the collision affect

insertions , deletions and searches

82
New cards
<p>how does separate chaining solve collision issues </p>

how does separate chaining solve collision issues

storing a single linked list in each index A[j]

83
New cards
<p>Linear probing </p>

Linear probing

is another way of dealing with collision

84
New cards
<p>graph </p>

graph

finite non empty sets of points and lines

85
New cards
<p>Undirected graph </p>

Undirected graph

edge between each vertex pair is not directed

86
New cards
<p>Directed graph </p>

Directed graph

edge between each vertex has a direction

87
New cards
<p>Multigraph </p>

Multigraph

there is more or one edge between a pair of vertices

88
New cards

what is a complete graph (Kn)

simple graph with n vertices where there is an edge between every pair of distance vertices

89
New cards

when is a graph connected

there is a path between every pair of vertices

90
New cards
<p>total degree </p>

total degree

sum of degrees of all vertices

91
New cards

in a directed graph what is an in degree in-deg(v)

number of edges that are incoming in v

92
New cards
<p>in a directed graph what is an out degree out-deg(v)</p>

in a directed graph what is an out degree out-deg(v)

number of edges that are out coming in v

93
New cards

what is a circuit

path which starts and ends at the same vertex

94
New cards
<p>what is a cycle </p>

what is a cycle

circuit that contains no repeated vertices

95
New cards
<p>what is a tree </p>

what is a tree

undirected graph that contains no cycle and is connected

96
New cards

Rooted trees

one vertex is specified as root

97
New cards
<p>what is a subtree of tree t </p>

what is a subtree of tree t

tree consisting of a vertex in t and all its descendants

98
New cards
<p>binary tree </p>

binary tree

rooted tree in which each parent has at most two children

99
New cards
<p>full binary tree </p>

full binary tree

each parent has exactly two children

100
New cards
<p>full m-ary tree </p>

full m-ary tree

each parent has exactly m children