

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


array - worst case time complexity - Answers - acces: O(1) search: O(n) insertion: O(n) deletion: O(n) stack - worst case time complexity - Answers - access: O(n) search: O(n) insertion: O(1) deletion: O(1) queue - worst case time complexity - Answers - access: O(n) search: O(n) insertion: O(1) deletion: O(1) singly-linked list - worst case time complexity - Answers - access: O(n) search: O(n) insertion: O(1) deletion: O(1) doubly-linked list - worst case time complexity - Answers - acces: O(n) search: O(n) insertion: O(1) deletion: O(1) binary search tree - worst case time complexity - Answers - acces: O(n) search: O(n) insertion: O(n) deletion: O(n) quick sort - worst case time complexity - Answers - O(n^2) merge sort - worst case time complexity - Answers - O(nlogn) bubble sort - worst case time complexity - Answers - O(n^2) insertion sort - worst case time complexity - Answers - O(n^2) selection sort - worst case time complexity - Answers - O(n^2) linked list - Answers -- linear data structure
left subtree of a node contains only nodes with key lesser than the node's key
right subtree of a node contains only nodes with keys greater than the node's key
left and right subtree each must also be a binary search tree bubble sort - what is it - Answers -- not a sorting algorithm we'd likely want to use in the real world
O(n) passes through array
O(n) time for each pass plus side don't need any extra memory for this algorithm insertion sort - what is it - Answers -- based on idea that one element from the input is consumed in each iteration to find its correct position (i.e. where it belongs in a sorted array)
all elements larger than the current element are shifted to one position ahead in the sorted array
two nested loops plus side makes no more than O(n) swaps, so it's useful when memory write is a costly operation merge sort - what is it - Answers -- divide & conquer algorithm