hw2sol - Exercise 10.1-1 4 Push(S,4) 1 2 3 4 5 6 top[S] = 1...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Exercise 10.1-1 4 Push(S,4) 1 2 3 4 5 6 top[S] = 1 4 1 Push(S,1) 1 2 3 4 5 6 top[S] = 2 4 1 3 Push(S,3) 1 2 3 4 5 6 top[S] = 3 4 1 3 Pop(S) 1 2 3 4 5 6 top[S] = 2 4 1 8 Push(S,8) 1 2 3 4 5 6 top[S] = 3 4 1 8 Pop(S) 1 2 3 4 5 6 top[S] = 2 1 Exercise 10.1-3 4 Enqueue(Q,4) 1 2 3 4 5 6 4 1 1 2 3 4 5 6 4 1 3 1 2 3 4 5 6 4 1 3 1 2 3 4 5 6 4 1 3 8 1 2 3 4 5 6 4 1 3 8 1 2 3 4 5 6 Enqueue(Q,1) Enqueue(Q,3) Dequeue(Q) Enqueue(Q,8) Dequeue(Q) Head[Q] = 1 Tail[Q] = 2 Head[Q] = 1 Tail[Q] = 3 Head[Q] = 1 Tail[Q] = 4 Head[Q] = 2 Tail[Q] = 4 Head[Q] = 1 Tail[Q] = 5 Head[Q] = 3 Tail[Q] = 5 2 Problem 10-1 Unsorted,Single Sorted,Single UnsortedDouble SortedDouble Search ( L,k ) O ( n ) O ( n ) O ( n ) O ( n ) Insert ( L,x ) O (1) O ( n ) O (1) O ( n ) Delete ( L,x ) O ( n ) O ( n ) O (1) O (1) Successor ( L,x ) O ( n ) O (1) O ( n ) O (1) Predecessor ( L,x ) O ( n ) O ( n ) O ( n ) O (1) Minimum ( L ) O ( n ) O (1) O ( n ) O (1) Maximum ( L ) O ( n ) O ( n ) O ( n ) O (1) Exercise 11.2-2 1 2 3 4 5 6 7 8 10 19 28 20 12 5 12 15 17 3 Exercise 11-2-3...
View Full Document

This note was uploaded on 10/21/2011 for the course CSCI 4041 taught by Professor Arindambanerjee during the Spring '09 term at Minnesota.

Page1 / 8

hw2sol - Exercise 10.1-1 4 Push(S,4) 1 2 3 4 5 6 top[S] = 1...

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

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