Upgrade to remove ads
Data Structures Exam 2
Terms in this set (35)
Value, and a pointer to the next node
What is the structure of a node?
Head node which is the first node in the list. It holds a value and a pointer pointing to the address of the next node in the list. Every node that follows is structured the same. The list ends at a Tail pointer which holds a value, and a pointer pointing to null.
What is the anatomy of a singly linked list?
LIFO, Last In First Out
In what order do items leave a stack?
FIFO, First In First Out
In what order do items leave in a queue?
Either way, Deques are double ended queues, so items can be inserted or removed at either end.
In what order do items leave in a deque?
Push, and Pop
What are the operations for inserting or removing items in a stack?
Put something on the top of the stack.
What does the 'Push' operation in a stack do?
Take something off the top of the stack.
What does the 'pop' operation in a stack do?
(Constructor): constructs stack
empty: Tests whether container is empty
size: returns size
top: Access next element
emplace: construct and insert elements
swap: swap contents
What are the other STL Stack operations, and what do they do?
Linear, Circular, Priority
What are the types of Queues?
FIFO, the first item added is the first item taken out (or accessed).
How are items in a linear queue accessed?
By priority, each item is given priority above or below another item(s) and these priorities dictate the order.
How are items in a priority queue accessed?
The same ones as the stack.
What are the STL Queue Operations?
A value, a pointer pointing to the left child, and a pointer pointing to the right child.
What is the node structure in a Binary Tree?
Can a binary tree be empty?
Every node is reachable from the root via a unique path.
How are nodes reached in a binary tree?
A node with no children.
What is a leaf?
The number of nodes in the tree (including the root).
What is the 'size' of a binary tree?
The distance from the root.
What is the depth of a node?
The depth of the deepest node.
What is the depth of a Binary Tree?
To visit each node in the tree exactly once.
What does it mean to traverse a binary tree?
Preorder, Inorder, and Postorder
What are the ways to traverse a tree?
Begin at the root and go through the left children before moving through the right children.
How do you accomplish a preorder traversal?
Traverse to the left side of the tree at the biggest depth. You then go to its parent before traversing to the right child.
How do you accomplish a Inorder traversal?
Go to the left side of the tree with biggest depth, then traverse to the right child.
How do you accomplish a postorder traversal?
A Binary tree that stores keys in each node.
What is a Binary Search Tree?
The root (or parent) is given a value. All children to the left of the root (or parent) hold smaller values than the root (or parent). All key values in the right subtree are given values larger than the root (or parent).
How are Binary Search Tree key's organized?
The root is 15, so it would find it instantly.
When searching for value 15 in a BST, the root being 15, how would the computer find this value.
It would know the left subtree contains key values smaller than the root value of 15. So it would search the left subtree like this until the value is found.
When searching in a BST with root 15, how would the computer find < 15?
It would know the right subtree contains key values larger than the root value of 15. So it would search the right subtree like this until the key value is found.
When searching for value 15 with a root key value of 15, how would the computer find a value of >15?
When the operator is put between the operands (the values being used by the operator). "A+B"
What is Infix notation?
Where the operator is placed after the operands. "AB+"
What is Postfix notation?
Where the Operator precedes the operands. "+AB"
What is Prefix Notation?
Which Notation requires parenthesis to change the order in which operations are done?
What ordering to the other notations (besides infix) go by?
YOU MIGHT ALSO LIKE...
CS 20, Data Structures Final
CIST 1305 Unit 09 Quiz
OTHER SETS BY THIS CREATOR
Data Structures Final Spring 2018
Data Structures Exam 1