ArrayList, LinkedList, & BST Extension WS Time Complexities

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Backed by a linked list: What is the time complexity of checking the size of the queue assuming there is a size variable?

O(1)

Backed by a linked list: What is the time complexity of checking the size of the stack?

O(1)

Backed by a linked list: What is the time complexity of determining if the queue is empty?

O(1)

Backed by a linked list: What is the time complexity of determining if the stack is empty?

O(1)

Backed by a linked list: What is the time complexity of looking at the front of the queue?

O(1)

Backed by a linked list: What is the time complexity of peeking at the top of the stack?

O(1)

Backed by a linked list: What is the time complexity of popping data off the stack?

O(1)

Backed by a linked list: What is the time complexity of pushing data onto the stack?

O(1)

Backed by a linked list: What is the time complexity to dequeue data out of the queue?

O(1)

Backed by a linked list: What is the time complexity to enqueue data into the queue assuming there is a tail pointer?

O(1)

Backed by an array: What is the time complexity of checking the size of the queue assuming there is a size variable?

O(1)

Backed by an array: What is the time complexity of checking the size of the stack?

O(1)

Backed by an array: What is the time complexity of determining if the queue is empty?

O(1)

Backed by an array: What is the time complexity of determining if the stack is empty?

O(1)

Backed by an array: What is the time complexity of looking at the front of the queue?

O(1)

Backed by an array: What is the time complexity of peeking at the top of the stack?

O(1)

Backed by an array: What is the time complexity of popping data off the stack?

O(1)

Backed by an array: What is the time complexity of pushing data onto a stack that is not full?

O(1)

Backed by an array: What is the time complexity to dequeue data out of the queue?

O(1)

Backed by an array: What is the time complexity to enqueue data into a queue that is not full?

O(1)

Given a CSLL with just a head pointer, what is the time complexity of adding to the back of the list?

O(1)

Given a CSLL with just a head pointer, what is the time complexity of removing the front of the list?

O(1)

Given a DLL with both a head and tail pointer, what is the time complexity for removing from the back of the list?

O(1)

Given a SLL with both a head and tail pointer, what is the time complexity for accessing an element from the back of the list?

O(1)

Given a SLL with only a head pointer, what is the time complexity for adding to the front of the list?

O(1)

What is the time complexity of accessing data at a known index in an ArrayList?

O(1)

What is the time complexity to add data at the back of an ArrayList which is not at capacity?

O(1)

What is the time complexity to remove data at the back of an ArrayList?

O(1)

Backed by an array: What is the time complexity of pushing data onto a stack?

O(1)*

Backed by an array: What is the time complexity to enqueue data into a queue?

O(1)*

What is the time complexity of adding data at the back in an ArrayList?

O(1)*

What is the worst case of searching a complete BST?

O(log n)

Backed by a linked list: What is the time complexity to enqueue data into the queue assuming there is NO tail pointer?

O(n)

Backed by an array: What is the time complexity of pushing data onto a full stack?

O(n)

Backed by an array: What is the time complexity to enqueue data into a full queue?

O(n)

Given a CSLL with a head pointer, what is the time complexity of creating a DLL with both a head and tail pointer in reverse order of the original CSLL?

O(n)

Given a CSLL with just a head pointer, what is the time complexity of accessing the last element of the list?

O(n)

Given a CSLL with just a head pointer, what is the time complexity of removing the back of the list?

O(n)

Given a DLL with just a tail pointer, what is the time complexity of converting the DLL into a new SLL with a head and tail pointer without changing the DLL?

O(n)

Given a DLL with only a head pointer, what's the time complexity for accessing an element in the middle of the list?

O(n)

Given a DLL with only a head pointer, what's the time complexity for adding to the back of the list?

O(n)

Given a SLL with a head pointer, what is the time complexity of converting the SLL into a new CSLL without changing the original SLL?

O(n)

Given a SLL with both a head and tail pointer, what is the time complexity for removing from the back of the list?

O(n)

Given a SLL with only a head pointer, what is the time complexity for accessing an element in the middle of the list?

O(n)

Given a sorted SLL with only a head pointer, what is the time complexity of creating another SLL with just a head pointer in reverse order of the original SLL?

O(n)

Given an array of data, what is the time complexity for converting the array into a DLL with just a head pointer?

O(n)

Given an array of sorted data, what is the time complexity for converting the array into a SLL with both a head and tail pointer?

O(n)

What is the time complexity of adding data at an arbitrary index in a full ArrayList?

O(n)

What is the time complexity of adding data at the back in a full ArrayList?

O(n)

What is the time complexity of adding data at the front in a full ArrayList?

O(n)

What is the time complexity of finding data in an ArrayList and you do not know its index?

O(n)

What is the time complexity of preorder, postorder, inorder, and level-order traversals?

O(n)

What is the time complexity to add data at an arbitrary index ArrayList which is not at capacity?

O(n)

What is the time complexity to add data at the front of an ArrayList which is not at capacity?

O(n)

What is the time complexity to remove data at an arbitrary index within an ArrayList?

O(n)

What is the time complexity to remove data at the front of an ArrayList?

O(n)

What is the time complexity to resize an ArrayList?

O(n)

What is the worst case of time complexity of searching an element in a full BST?

O(n)

What is the worst case time complexity of calculating the height of a BST?

O(n)

What is the worst case time complexity of checking if an element is contained in a BST?

O(n)

What is the worst case time complexity of creating a sorted linked list from a BST where you must add to the front of the linked list?

O(n)

What is the worst case time complexity of finding the successor in a BST?

O(n)

What is the worst case time complexity of transforming a linked list into a BST?

O(n^2)


Kaugnay na mga set ng pag-aaral

Introduction to Machine Learning

View Set

5086 (British Colonization: 1580s to 1760s)

View Set

Exam 4: Thyroid Disorder (NCLEX)

View Set

Chapter 14 Pharmacology Drugs used for sleep

View Set

Macro Unit 2: Economic Indicators and the Business Cycle

View Set

CHAPTER 1: STRUCTURE & PROPERTIES OF THE ATOM (QUESTIONS)

View Set