2.3.1 Algorithms Flashcards
What are the sorting algorithms we’ve learned? (4)
Bubble sort (1) insertion sort (1) merge sort (1) Quick sort (1)
What are the searching algorithms we’ve learned? (2)
Binary search (1) Linear search (1)
What is the precondition for a binary search? (1)
Data must be in order (1)
Which sorting algorithm uses divide and conquer? (1)
Merge sort (1)
What are the different Big O notation categories? (5)
Constant - O(1) (1) linear O(n) (1) polynomial - O(n^2) (1) Exponential - O(2^n) (1) Logarithmic - O(log n) (1)
What is the time complexity of bubble and insertion sort? (1)
Polynomial - O(n^2)
What is the time complexity of merge sort? (1)
O(n log n)
What is the time complexity of quick sort? (1)
Polynomial - O(n^2)
What is the time complexity of a linear search? (1)
Linear - O(n)
What is the time complexity of a binary search? (1)
Logarithmic - O(log n)
What are the key features of a stack data structure? (4)
Last in first out (LIFO) (1) It has an array to store data (1) with a pointer to show the top of the stack (1) items are added to the top using the pointer (1) items are removed from the top using the pointer (1)
What are the key features of a queue data structure? (4)
First in first out (FIFO) (1) It has an array to store data (1) with a pointer for the head and tail (1) items are removed from the front using head (1) items are added to the rear using tail (1)
What are the key features of a tree data structure? (4)
1 directional data structure (1) Has a root node with no incoming edges (1) branch nodes with incoming and outgoing edges (1) leaf nodes with incoming edges only (1) unweighted (1) dynamic (1)
What are the key features of a binary tree data structure? (4)
Each node has maximum 2 outgoing edges (1) data lower in the sequence goes left (1) data higher in the sequence goes right (1) has a root branches and leaves (1)
What are the pointers in a linked list? (2)
head or headpointer points to the start of the list (1) next free or freelistpointer points to the first free space (1)