1. Describe how one can implement each of the following


 1. Describe how one can implement each of the following operations on an array so that the time it takes does not depend on the array’s size n. a. Delete the ith element of an array (1 ≤ i ≤ n).

 b. Delete the ith element of a sorted array (the remaining array has to stay sorted, of course). 

2. If you have to solve the searching problem for a list of n numbers, how can you take advantage of the fact that the list is known to be sorted? Give separate answers for

 a. lists represented as arrays.

 b. lists represented as linked lists.

 3. a. Show the stack after each operation of the following sequence that starts with the empty stack: push(a), push(b), pop, push(c), push(d), pop

 b. Show the queue after each operation of the following sequence that starts with the empty queue: enqueue(a), enqueue(b), dequeue, enqueue(c), enqueue(d), dequeue 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Obtain the general solution of the following DEs: i. y′′′ + y′′ − 4y′ + 2y = 0 ii. y(4) + 4y(2) = 0 iii. x(x − 2)y′′ + 2(x − 1)y′ − 2y = 0; use y1 = (1 − x) iv. y′′ − 4y = sin2(x) v. y′′ − 4y′ + 3y = x ; use y1 = e3x vi. y′′ + 5y′ + 6y = e2xcos(x) vii. y′′ + y = sec(x) tan(x)

Obtain the general solution of the following DEs: i. y′′′ + y′′ − 4y′ + 2y = 0 ii. y(4) + 4y(2) = 0 iii. x(x − 2)y′′ + 2(x − 1)y′ − 2y = 0; use y1 = (1 − x) iv. y′′ − 4y = sin2(x) v. y′′