Final Flashcards
explain the concept of data structures
collection of organized data eg. an integer is a type of data and an array of integers stored in the computer is a data structure
explain the concept of algorithms
step-by-step process that performs action on a data structure eg. finding the smallest integer in an array of integers
distinguish the difference between an interface and an implementation
interface- what a data structure does
implementation- how the structure does it
what is a FIFO queue?
first-in-first-out eg. checking out at the grocery store
what is a priority queue?
smallest element is always removed eg. emergency waiting room
what is a LIFO (stack) queue?
last-in-first-out eg. stack of plates
what is a USet?
a set of n distinct elements (no two elements are the same)
what is a SSet?
a sorted set
implement an ArrayStack
see notebook
implement an ArrayQueue
see notebook
implement an ArrayDeque
see notebook
implement a DualArrayDeque
see notebook
implement a RootishArrayStack
see notebook
what is the primary advantage and disadvantage of a linked list?
advantage- delete and insert in constant time
disadvantage- cannot get(i) and set(i,x) in constant time
implement add(x)/remove()/push(x)/pop() of a SLList
see notebook
what is the time complexity of a DLList for get(i)/set(i,x)/add(i,x)/remove(i)?
O(n)
implement a SkipListSSet
see notebook
implement a ChainedHashTable
see notebook
describe linear probing
on a linear hash table, if the index given by the hash function to store an element is already occupied, the next location is checked until an available location is found or the table is full
what are the two properties of hash code mappings?
- if x and y are equal, then x.hashCode() and y.hashCode should be equal
- if x and y are not equal, then the probability that x.hashCode() and y.hashCode() are equal should be very small
what is division hashing?
k % tableSize
what is multiplication hashing?
when you take k and multiply it by some number between 0 and 1 then take the decimal part and multiply that by the tableSize
what is folding hashing?
when you break an object into parts then add those parts together then do k % tableSize
eg. social security number
244 + 176 + 244 = k
what is radix transformation?
a hashing method where the base of a number is changed to form a new sequence of digits then the division method is applied
what is digit rearrangement?
a hashing method where the original sequence of numbers is somehow rearranged and then the division method is applied
what is length-dependent hashing?
when the key and length is combined in some way way to produce the index directly or a secondary step