Presentation is loading. Please wait.

Presentation is loading. Please wait.

Map SortedMap Figure 14.1 The Collection interfaces Collection ListSet SortedSet.

Similar presentations


Presentation on theme: "Map SortedMap Figure 14.1 The Collection interfaces Collection ListSet SortedSet."— Presentation transcript:

1 Map SortedMap Figure 14.1 The Collection interfaces Collection ListSet SortedSet

2 Figure 14.2 Adding an element at the end of an ArrayList today Before addingAfter adding Add position

3 Figure 14.3 Add an element at position 50 in an ArrayList index 4950515253 999910000 Before adding...today... today After adding today... today... today

4 Figure 14.4 Finding element 5000 in a linked list index01234 5000 today... today head

5 Amazon4000 Indus1800 Chang (Yangtze)3964 Mekong2600 Colorado1450 Mississippi2340 Columbia1243 Missouri2315 Congo2718 Niger2590 Danube1776 Nile4160 Euphrates1700 Rio Grande1900 Ganges1560 Volga2290 Huang (Yellow)3395 Figure 14.5 Rivers of the world and their lengths (in miles)

6 a. unbalancedb. balanced Missouri Niger Nile Missouri Niger Nile Figure 14.6 Example of trees

7 SizeNatural logarithm RatioObserved time Predicted time 1004.61.01953 10006.91.528142929 100009.22.036853906 10000011.52.547774882 Figure 14.7 Predictions based on ln n efficiency

8 /* Groups fields for a name/ * Uses toString to display */ package personData; public class Name { String first; char initial; String last; public Name(String f, String l) { first = f; last = l; } public String toString() { if (initial == '\u0000') return first + " " + last; else return first + " " + initial + " " + last; } Figure 14.8 A Name class

9 Name president = new Name(“George”, “Washington”); Name first = new Name(“George”, “Washington”); president first “George”, “Washington” Figure 14.9 Two Name instances


Download ppt "Map SortedMap Figure 14.1 The Collection interfaces Collection ListSet SortedSet."

Similar presentations


Ads by Google