specialized structures such as stackswhich allow access to only certain data itemswhich of these general-purpose data structures is appropriate for given problemfigure shows first approximation to this question howeverthere are many factors besides those shown in the figure for more detailwe'll explore some general considerations firstand then zero in on the individual structures figure relationship of general-purpose data structures speed and algorithms the general-purpose data structures can be roughly arranged in terms of speedarrays and linked lists are slowtrees are fairly fastand hash tables are very fast howeverdon' draw the conclusion from this figure that it' always best to use the fastest structures there' penalty for using them firstthey are--in varying degrees--more complex to program than the array and linked list alsohash tables require you to know in advance about how much data can be storedand they don' use memory very efficiently ordinary binary trees will revert to slow (noperation for ordered dataand balanced treeswhich avoid this problemare difficult to program computers grow faster every year the fast structures come with penaltiesand another development makes the slow structures more attractive every year there' an increase in the cpu and memoryaccess speed of the latest computers moore' law (postulated by gordon moore in specifies that cpu performance will double every months this adds up to an astonishing difference in performance between the earliest computers and those available todayand there' no reason to think this increase will slow down any time soon suppose computer few years ago handled an array of objects in acceptable time nowcomputers are times fasterso an array with , objects can run at the same speed many writers provide estimates of the maximum size you can make data structure before it becomes too slow don' trust these estimates (including those in this booktoday' estimate doesn' apply to tomorrow insteadstart by considering the simple data structures unless it' obvious they'll be too slowcode simple version of an array or linked list and see what happens if it runs in acceptable timelook no further why slave away on balanced treewhen no one would ever notice if you used an array insteadeven if you must deal with thousands or tens of thousands of itemsit' still worthwhile to see how well an array or linked list will handle