1 / 2

Assignment #2 (Assignment due: Wed., Oct. 26, 2011)

Assignment #2 (Assignment due: Wed., Oct. 26, 2011). 1.(20) (i) Please explain why the algorithm that uses Stack to compute the spans of stock prices is better than the algorithm that does not use stack. (15) (ii) Discuss the difference between Vectors and Lists. (5)

halen
Download Presentation

Assignment #2 (Assignment due: Wed., Oct. 26, 2011)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assignment #2 (Assignment due:Wed., Oct. 26, 2011) 1.(20) (i) Please explain why the algorithm that uses Stack to compute the spans of stock prices is better than the algorithm that does not use stack. (15) (ii) Discuss the difference between Vectors and Lists. (5) 2.(45) Assume that in an array A[10], we have stored ten strings: Baltimore, Rome, Seattle, Toronto, Berlin, London, Athen, Bejing, Vancouver, Winnipeg, (i) write a method to store them in a singly linked list. (10) (ii) write a method to store them in a doubly linked list. (10) (iii) write a method to remove the last node from the singly linked list. (10) (iv) write a method which is able to remove any indicated node from the doubly linked list. (15)

  2. Assignment #2 (Assignment due:Wed., Oct. 26, 2011) 3.(35) A breadth-first search traverses a tree as shown in Fig. 1. Please write an algorithm (not a Java program) to search a tree in the breadth-first manner by using the queue data structure to control the process. Fig. 1

More Related