Lec17Review2InClass

Lec17Review2InClass - Create a max-heap (the biggest number...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Create a max-heap (the biggest number is on top) with this set of inserts: 5 10 8 16 3 2 Linked list with only a head pointer What is the algorithmic complexity for: addHead / addFront O(1) addTail / addBack O(n) removeHead / removeFront O(1) removeTail / removeBack O(n) We add a tail pointer to the linked list Which method (or methods) change their complexity based on this tail pointer? addBack / addTail O(1) Inside the links, we have not only a “next” pointer, but also a “prev” pointer. This is called a doubly linked list. Which method(or methods) change their complexity based on this prev pointer? removeBack / removeTail O(1) When implementing a stack, what pair(s) of methods will result in correct execution? addHead and removeHead addTail and removeTail Which pair will result in an efficient execution? addHead and removeHead Of the three LL variations, what is the simplest one that will provide both methods in constant time? linked list with only a head pointer
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 24 taught by Professor Agrawal during the Fall '09 term at UCSB.

Page1 / 2

Lec17Review2InClass - Create a max-heap (the biggest number...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online