WGU C949 STUDY GUIDE EXAM UPDATED QUESTIONS
AND CORRECT ANSWERS WITH GUARANTEED PASS
Array-ANSWER An array is a data structure that holds an ordered list of
elements, each of which may be accessed directly using a positional index.
A linked list is a data structure that has an ordered list of objects in nodes, each
of which has a pointer to the next node and stores data.
A data structure with up to two children, referred to as a left child and a right
child, in which each node stores data is called a binary search tree.
A hash table is a data structure that maps (or hashes) each item to a point in an
array (or vector) in order to store unordered objects.
Each item is mapped to a place in an array (in a hash table) by the hashing
algorithm.
Chaining: To prevent hash table collisions, ANSWER uses a list for every
bucket, which may include several items that map to the same bucket.
When mapping an index, the hash key is the ANSWER value.
bucket-ANSWER each hash table array element
For example, a hash table with 100 items has 100 buckets.
ANSWER uses the items key to calculate a bucket index modulo the hash
algorithm.
Each bucket will be mapped to (num_keys / num_buckets) keys.
For example... Each bucket will contain five keys from 0 to 49.
50/10 = 5.
ANSWER: Hash tables facilitate quick inserts, deletions, and searches.
requires O(1) on average.
, O(N) is necessary for linear search.
This is used by the modulo operator %-ANSWER common has function. which,
when two numbers are divided, calculates the integer remainder.
For example, a hash function of key % 20 will map keys to bucket indices 0 to
19 for a hash table with 20 elements.
A binary tree that upholds the straightforward characteristic that a node's key is
greater than or equal to the keys of its offspring is known as a max-heap.
Although it can be any tree, a max-heap is often a binary tree.
*The maximum key in the entire tree is always found at the root of a max-heap.
Heap storage ANSWER Arrays are commonly used to store heaps. When a
heap is represented by a tree, the layers of the tree are traversed from top to
bottom and left to right to create the array form of the heap. The entry at index 0
in the array is always the root node; the entry at index 1 is the root's left child;
the entry at index 2 is the root's right child; and so on.
Inserting a node into a max-heap begins with the node being inserted in the last
level of the tree. The node is then switched with its parent until the max-heap
property is not violated.
Percolating is the term used to describe a node's upward migration within a
max-heap.
Complexity O(logN)
Max-heap remove - ANSWER Usually a root removal, this is accomplished by
swapping the root for the final node of the level and then switching that node
with its greatest child until the max-heap property is not violated.
Complexity O(logN)
Percolating: ANSWER A node's upward motion in a max-heap
A node's key is less than or equal to its children's keys in a min-heap, which is
comparable to a max-heap.
Heap - Parent and child indices - ANSWER Heaps are not implemented with
parent/child pointers and node structures, so it is necessary to refer to nodes by
index in order to traverse from one node to parent or child nodes. The heap's
parent and child index formulas are displayed in the table below.
ie
1) The node at index 12's parent index? 5.
AND CORRECT ANSWERS WITH GUARANTEED PASS
Array-ANSWER An array is a data structure that holds an ordered list of
elements, each of which may be accessed directly using a positional index.
A linked list is a data structure that has an ordered list of objects in nodes, each
of which has a pointer to the next node and stores data.
A data structure with up to two children, referred to as a left child and a right
child, in which each node stores data is called a binary search tree.
A hash table is a data structure that maps (or hashes) each item to a point in an
array (or vector) in order to store unordered objects.
Each item is mapped to a place in an array (in a hash table) by the hashing
algorithm.
Chaining: To prevent hash table collisions, ANSWER uses a list for every
bucket, which may include several items that map to the same bucket.
When mapping an index, the hash key is the ANSWER value.
bucket-ANSWER each hash table array element
For example, a hash table with 100 items has 100 buckets.
ANSWER uses the items key to calculate a bucket index modulo the hash
algorithm.
Each bucket will be mapped to (num_keys / num_buckets) keys.
For example... Each bucket will contain five keys from 0 to 49.
50/10 = 5.
ANSWER: Hash tables facilitate quick inserts, deletions, and searches.
requires O(1) on average.
, O(N) is necessary for linear search.
This is used by the modulo operator %-ANSWER common has function. which,
when two numbers are divided, calculates the integer remainder.
For example, a hash function of key % 20 will map keys to bucket indices 0 to
19 for a hash table with 20 elements.
A binary tree that upholds the straightforward characteristic that a node's key is
greater than or equal to the keys of its offspring is known as a max-heap.
Although it can be any tree, a max-heap is often a binary tree.
*The maximum key in the entire tree is always found at the root of a max-heap.
Heap storage ANSWER Arrays are commonly used to store heaps. When a
heap is represented by a tree, the layers of the tree are traversed from top to
bottom and left to right to create the array form of the heap. The entry at index 0
in the array is always the root node; the entry at index 1 is the root's left child;
the entry at index 2 is the root's right child; and so on.
Inserting a node into a max-heap begins with the node being inserted in the last
level of the tree. The node is then switched with its parent until the max-heap
property is not violated.
Percolating is the term used to describe a node's upward migration within a
max-heap.
Complexity O(logN)
Max-heap remove - ANSWER Usually a root removal, this is accomplished by
swapping the root for the final node of the level and then switching that node
with its greatest child until the max-heap property is not violated.
Complexity O(logN)
Percolating: ANSWER A node's upward motion in a max-heap
A node's key is less than or equal to its children's keys in a min-heap, which is
comparable to a max-heap.
Heap - Parent and child indices - ANSWER Heaps are not implemented with
parent/child pointers and node structures, so it is necessary to refer to nodes by
index in order to traverse from one node to parent or child nodes. The heap's
parent and child index formulas are displayed in the table below.
ie
1) The node at index 12's parent index? 5.