Docsity

WGU C949 Data Structures and Algorithms, Exams of Computer Science

Toggle sidebar
bg1
1 / 9
1,000,00
0
^2
)
WGU C949 Data Structures and Algorithms
1. A functions whose cost scales linearly with the size of the input: O(n)
2. Iterating
over a collection of data once often indicates an
algorithm. (alphabet for-loop example): O(n)
3. A functions whose cost scales logarithmically with the input size: O(log
n)
4. Which type of function works by breaking down large problem into
smaller and smaller chunks?: O(log n)
5. As the size of the input grows the cost of the algorithm does not
increase
at the same rate. The overall cost of performing an operation on
items is only twice that of performing the operation on 1,000
items.: O(log n)
6. A function that exhibits quadratic growth relative to the input size:
O(n^2)
7. An example of this type of function is doubly nested loop:
O(n^2)
8. Which type of function gets really expensive really quickly?: O(n
9. A function that has two inputs that contribute to growth:
O(nm)
10. An example of this type of function is when there is a
nested loop that iterates of two distinct collections of data: O(nm)
11. Are Big-O cases used in the best or worst situations?:
Worst
12. Which statement is static?
readonly Contact[] contacts = new Contact[];
readonly Contact
contacts = new Contacts[100];: readonly Contact contacts =
new Con-
tacts[100];
13. A container where data is stored in nodes consisting of a single
data item and a reference to the next node: Linked List
14. A is a container where nodes of data are linked
together into a
list: Linked List
15.
Linking
together
complex
nodes
into
a
single
structure:
Linked
List
16. Each link in a chain for
a linked lists is called a :
node
17.
What
two
things
do
nodes
contain?:
1. the
value
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download WGU C949 Data Structures and Algorithms and more Exams Computer Science in PDF only on Docsity!

^

WGU C949 Data Structures and Algorithms

  1. A functions whose cost scales linearly with the size of the input: O(n)
  2. Iterating over a collection of data once often indicates an algorithm. (alphabet for-loop example): O(n)
  3. A functions whose cost scales logarithmically with the input size: O(log n)
  4. Which type of function works by breaking down large problem into smaller and smaller chunks?: O(log n)
  5. As the size of the input grows the cost of the algorithm does not increase at the same rate. The overall cost of performing an operation on items is only twice that of performing the operation on 1, items.: O(log n)
  6. A function that exhibits quadratic growth relative to the input size: O(n^2)
  7. An example of this type of function is doubly nested loop: O(n^2)
  8. Which type of function gets really expensive really quickly?: O(n
  9. A function that has two inputs that contribute to growth: O(nm)
  10. An example of this type of function is when there is a nested loop that iterates of two distinct collections of data: O(nm)
  11. Are Big-O cases used in the best or worst situations?: Worst
  12. Which statement is static? readonly Contact[] contacts = new Contact[]; readonly Contact contacts = new Contacts[100];: readonly Contact contacts = new Con-tacts[100];
  13. A container where data is stored in nodes consisting of a single data item and a reference to the next node: Linked List
  14. A is a container where nodes of data are linked together into a list: Linked List
  15. Linking together complex nodes into a single structure: Linked List
  16. Each link in a chain for a linked lists is called a : node
  17. What two things do nodes contain?: 1. the value
  1. reference to next item in the list
  2. Give a coded example on how to create a 3 chained linked list of nodes.: Node head = new Node(1); head.Next = new Node(2); head.Next.Next = new Node(3);
  3. A list where we start at the first node and follow the chain of nodes iterating over each until we get to the end: Singly Linked List
  4. A list that builds on the singly linked list by adding reverse iteration.: Doubly Linked List
  5. Give a coded example on how to create a doubly linked list: Node node1 = new Node(1); Node node2 = new Node(2); Node node3 = new Node(3); node1.Next = node2; node2.Previous = node1; node2.Next = node3; node3.Previous = node2;
  6. The first and last nodes of a doubly linked list should have a value of : null
  7. Adds a value to the beginning of the list: AddHead
  8. Adds a value at the end of the linked list: AddTail
  9. Finds the first node whose value equals the provided argument: Find
  10. Returns true if the specified value exists in the list, false otherwise: Contains
  11. Removes the first node on the list whose value is equal to the argument: - Remove
  12. A doubly linked list where the values are inserted and sorted in

e top or the head or

  1. Adds the specified item to the linked list in the sort order of the item type: Add
  2. A way of organizing, storing, and performing operations on data: Data Structure
  3. A data structure that stores subitems, with a name associated with each subitem.: record
  4. A data structure that stores an ordered list of items, with each item is directly accessible by a positional index.: Array
  5. A data structure that stores ordered list of items in nodes, where each node stores data and has a pointer to the next node.: linked list
  6. A data structure in which each node stores data and has up to two children, known as a left child and a right child.: binary tree
  7. A data structure that stores unordered items by mapping (or hashing) each item to a location in an array.: hash table
  8. A tree that maintains the simple property that a node's key is greater than or equal to the node's childrens' keys.: max heap
  9. A tree that maintains the simple property that a node's key is less than or equal to the node's childrens' keys.: min heap
  10. A data structure for representing connections among items, and consists of vertices connected by edges.: graph
  11. This represents an item in a graph.: vertex
  12. This represents a connection between two vertices in a graph.: edge
  13. A Last-in, First-out (LIFO) data container: Stack
  14. When something is retrieved from a stack, does it come from th bottom of the stack?: Top
  15. A First-in, First-out (FIFO) container: Queue
  16. When something is removed from a queue, does it come from the tail?: Head
  17. When something is added to a queue, does it get added to the head or the tail?: Tail

ost______ , ates t

  1. A queue-like container which is both First-in, First-out and Last-in, Last-out- : Doubly Ended Queue (deque)
  2. Which type of function allows for items to be added or removed from the beginning or end?: Doubly Ended Queue (deque)
  3. A data structure where nodes have parent-child (1:N) relationship: Tree
  4. Each node in a Tree has at least parent, but the number of children depends on the type of tree: one
  5. Every node in a tree has how many parents?: one
  6. Every part of a tree spawns how many children?: 0 or more
  7. Nodes that have no children are called what?: Leaf nodes
  8. How many data items does each node on a tree contain?: one
  9. At most how many children can each node have in a binary tree?: two
  10. The maximum number of children that each node can have: Degree
  11. The maximum amount of edges between that node and a leaf: Height
  12. When smaller values are added to this tree smaller values are added to the left: Binary Search Tree
  13. The smallest value in a binary search tree will be on the bottom m while the largest value will be on the bottom most : left right
  14. The insertion complexity on average of a binary search tree: O(long n)
  15. The insertion complexity with the worst case of a binary search tree: O(n)
  16. The node is visited before it's children: Pre-order
  17. The left child is visited before the node, then the right child: In- order
  18. The left and right children are visited before the node: Post-order
  19. An example of why pre-order traversals are useful: To create an identical copy of a tree

ote the child ve the successor's me input:

  1. Removal Complexity in a Binary Tree: O(log n)
  2. Containers that contain key-value pairs: Associative Array
  3. A collection of key/value pairs where the key can only exist once in the collection: Associative Array
  4. An associative array container that provides O(1) insert, delete and search operations: Hash Table
  5. A function that maps data of arbitrary size to data of a fixed size: Hash Function
  6. For a function to qualify as a hash function it has to have what three properties: Stability Uniformity Security
  7. A hash function always generates the same output given the sa Stability
  8. A hash algorithm should distribute its resulting has value uniformly throughout the output space: Uniformity
  9. A secure hashing algorithm cannot be inverted (the input derived from the output hash): Security
  10. An integer counter that represents how many variables reference an ob-ject: Reference Count
  11. Equation for finding the middle value of an array: (high + low)/2 (DO NOT ROUND UP)
  12. How can a node with Two Children be removed from a tree?: Mo child up to the root node.
  13. How can a node with One Child be removed from a tree?: Prom
  1. If an object is assigned to null (int = null;), will the object be considered for garbage collection?: Yes (it's considered for garbage collection right once it's assigned to null)
  2. These can have any value, but cannot have matching keys: Dictionaries
  3. Dictionary keys must be and : unique immutable
  4. What method removes a value from a dictionary?: remove();
  5. Which method removes a key from a dictionary?: pop();
  6. Which method removes a key-value pair from a dictionary?: popitem();
  7. Which method removes all keys from a dictionary?: keys();
  8. There are 3 items in a stack, the next line of code is "push('item');". How many items are now in the stack?: 4
    1. Visit node
  9. Traverse left
  10. Traverse right: Preorder Traversal (Binary Tree)
  11. Cannot handle sets, lists or dictionaries: Hash Function
  12. A modulo hash function is used to map to indices 0 to 9. The hash function should be: key % : 10
  13. key % 1000 maps to indices 0 to .: 999
  14. A modulo hash function for a 50 entry hash table is: key % : 50
  15. A hash function computes a bucket index from an item's .: key
  16. A 100 element hash table has 100 .: buckets
  17. For a well-designed hash table, searching requires on average.: O(1)
  18. In a Hash Table keys need to be .: unique
  19. Given a hash table with 100 buckets and modulo hash function, in which bucket will HashInsert(table, item 334) insert item 334?: 34
  20. Given a hash table with 50 buckets and modulo hash