COSC 237 Final
Sequential search
Locates a target value in an array/list by examining each element from start to finish
binary trees have two sets of nodes
Lt and Rt (left subtree and right subtree)
Postorder traversal
Traverse left subtree traverse right subtree visit node (left right root)
complexity class
a category of algorithm efficiency based on the algorithm's relationship to the input size N
stack
a collection based on the principle of adding elements and retrieving them in the opposite order (LIFO) last in-first out
Efficiency
a measure of the use of computing resources by code
backward manner
a new node is always inserted at the beginning of the linked list
forward manner
a new node is always inserted at the end of the linked list
What is a leaf
a node in a tree with no children
push
add an element to the top
link
address (order of the nodes)
every node (except the last node) contains the
address of the next node
insertion sort
build an increasingly large sorted front portion
bucket sort
cluster elements into smaller groups, sort them
What are the components of a node
data and link
peek
examine the top element
You can build a list in two ways
forward or backward
binary search successively eliminates
half of the elements
nodes
list of items
Binary Search
locates a target value in a sorted array/list by successively eliminating half of the array from consideration
binary search is of the order
log2n
selection sort
look for the smallest element, move to front
sequential search is of the order
n
building a linked list forward needs three reference variables
one to point to the front of the list one to point to the last node of the list one to create the new node
heap sort
place the values into a sorted tree structure
sorting
rearranging the values in an array or collection into a specific order
merge sort
recursively divide the array in half and sort it
quick sort
recursively partition array based on a middle value
pop
remove the top element
queue
retrieves elements in the order they were added (FIFO) first in-first out
binary trees have a special node called the
root node
bogo sort
shuffle and pray
radix sort
sort integers by last digit, then 2nd to last, then n
data
stores the relevant information
bubble sort
swap adjacent pairs that are out of order
Recursion
the definition of an operation in terms of itself
length of a path
the number of branches on that path
level of a node
the number of branches on the path from the root to the node
Height of a binary tree
the number of nodes on the longest path from the root to a leaf
inorder traversal
traverse left subtree visit node traverse right subtree (left root right)
Preorder traversal
visit node traverse left subtree traverse right subtree (root left right)
Recursive programming
writing methods that call themselves to solve problems recursively
Recursive case
A more complex occurrence of the problem that cannot be directly answered, but can instead be described in terms of smaller occurrences of the same problem
Base case
A simple occurrence that can be answered directly