Knowledge

Container (abstract data type)

Source đź“ť

51: 127:
The size of the container depends on the number of objects (elements) it contains. Underlying (inherited) implementations of various container types may vary in size, complexity and type of language, but in many cases they provide flexibility in choosing the right implementation for any given
380:
Many elemental types (e.g. integers or floating numbers) are inherently incompatible with each other because of the memory size they occupy and their semantic meaning and therefore require different containers (unless of course, they are mutually compatible or convertible). Modern programming
239:, map, or dictionary, composed of key-value pairs, such that each key appears at most once in the container. The key is used to find the value, the object, if it is stored in the container. 150:, that is the way of accessing the objects of the container. In the case of arrays, access is done with the array index. In the case of stacks, access is done according to the 411:
Permits storing types of different data sizes; it is hard to ensure which type is stored in a union upon retrieval however and should be carefully followed.
377:
Because of differences in element types this results in a tedious process of writing and keeping a collection of containers for every elemental type.
75: 489: 124:
whose instances are collections of other objects. In other words, they store objects in an organized way that follows specific access rules.
921: 484: 17: 402:
Previous three approaches above are used for weakly typed languages; these usually imply inheritance and polymorphism shared by types.
341:. Apart from their graphical properties, they have the same type of behavior as container classes, as they keep a list of their child 1088: 597: 1459: 1093: 428:
Ensures reusability and type safety; may be thought as a reverse inheritance. However, this approach may require implementing a
1083: 1078: 224:
Single-value containers store each object independently. Objects may be accessed directly, by a language loop construct (e.g.
891: 358: 570: 1515: 1066: 967: 367:
Container abstractions can be written in virtually any programming language, regardless of its type system. However, in
1244: 830: 543: 310: 93: 155: 1217: 620: 454: 449: 1139: 1071: 1033: 590: 699: 1510: 1234: 1164: 1012: 1489: 1124: 704: 687: 371: 1112: 903: 670: 665: 255: 250: 39: 506: 1422: 1374: 1286: 1264: 1259: 1187: 1053: 1007: 660: 338: 66: 1296: 960: 694: 653: 583: 374:
languages it may be somewhat complicated for a developer to write reusable homogeneous containers.
276: 117: 510: 1449: 1364: 934: 911: 444: 429: 35: 1192: 1048: 1002: 916: 716: 368: 362: 282: 240: 1182: 1157: 842: 797: 759: 984: 782: 295: 132: 8: 1454: 1432: 1359: 1212: 1204: 953: 423: 30:"Container (computer science)" redirects here. For the abstract notion of containers in 1437: 1417: 1369: 1344: 1129: 1098: 825: 810: 675: 635: 459: 346: 342: 334: 330: 306: 1324: 1254: 1229: 1043: 1038: 744: 643: 549: 539: 432:
which is reputedly a time-consuming process given that types differ in their methods.
271: 236: 61: 1469: 1354: 1152: 767: 419: 151: 109: 1474: 1339: 1291: 1224: 787: 729: 414: 154:(last in, first out) order and in the case of queues it is done according to the 27:
Software class or data structure whose instances are collections of other objects
1427: 1249: 1239: 1147: 879: 857: 682: 606: 326: 260: 121: 1504: 1349: 852: 749: 734: 553: 390:
A type that is universally assignable by any other (e.g. root Object class).
1306: 1281: 265: 1484: 1479: 1329: 1276: 1103: 847: 772: 533: 393: 301: 31: 1389: 1384: 1301: 1269: 1174: 1117: 835: 739: 405: 315: 291:
Common data structures used to implement these abstract types include:
1464: 1442: 1399: 1394: 1061: 1017: 976: 777: 724: 1379: 874: 820: 648: 279:, containing and indexing objects by value or by specific property; 229: 225: 202: 143:
Containers can be characterized by the following three properties:
575: 869: 815: 864: 805: 381:
languages offer various approaches to help solve the problem:
945: 170:, that is the way of traversing the objects of the container. 131:
Container data structures are commonly used in many types of
997: 886: 175: 164:, that is the way of storing the objects of the container; 992: 201:
Containers are sometimes implemented in conjunction with
571:
Container Data Structure Declaration and Initialization
243:
are used in programming languages as class templates.
197:
access the number of objects in the container (count).
1502: 538:(2nd ed.). Reading, Mass.: Addison-Wesley. 352: 191:delete all the objects in the container (clear); 535:An introduction to object-oriented programming 490:National Institute of Standards and Technology 285:, associating to each key a "value" for lookup 961: 591: 485:Dictionary of Algorithms and Data Structures 345:, and allow adding, removing, or retrieving 174:Container classes are expected to implement 968: 954: 598: 584: 527: 525: 523: 521: 519: 138: 94:Learn how and when to remove this message 182:create an empty container (constructor); 516: 492:.15 December 2004. Accessed 4 Oct 2011. 329:also use containers, which are special 246:Container abstract data types include: 213:Containers may be classified as either 14: 1503: 949: 579: 359:Statically-typed programming language 321: 531: 450:Standard Template Library#Containers 194:access the objects in the container; 44: 605: 178:-like methods to do the following: 24: 188:delete objects from the container; 185:insert objects into the container; 25: 1527: 564: 235:An associative container uses an 333:to group other widgets, such as 49: 478:Paul E. Black (ed.), entry for 455:Collection (abstract data type) 975: 495: 472: 272:Key-associated data structures 13: 1: 1034:Arbitrary-precision or bignum 465: 353:In statically-typed languages 158:(first in, first out) order; 7: 1516:Object-oriented programming 922:Directed acyclic word graph 688:Double-ended priority queue 438: 372:object-oriented programming 69:. The specific problem is: 10: 1532: 356: 40:Container (disambiguation) 29: 18:Container (data structure) 1408: 1375:Strongly typed identifier 1317: 1203: 1173: 1138: 1026: 983: 930: 902: 796: 758: 715: 634: 613: 654:Retrieval Data Structure 208: 1450:Parametric polymorphism 935:List of data structures 912:Binary decision diagram 507:Encyclopædia Britannica 445:List of data structures 430:template specialization 215:single-value containers 139:Function and properties 36:Container (type theory) 917:Directed acyclic graph 532:Budd, Timothy (1997). 363:Strong and weak typing 349:among their children. 241:Associative containers 219:associative containers 38:. For other uses, see 309:(BSTs), particularly 298:and their derivatives 133:programming languages 783:Unrolled linked list 513:Accessed 4 Oct 2011. 387:Universal basic type 76:improve this article 65:to meet Knowledge's 1511:Abstract data types 1455:Primitive data type 1360:Recursive data type 1213:Algebraic data type 1089:Quadruple precision 831:Self-balancing tree 311:self-balancing BSTs 307:Binary search trees 1418:Abstract data type 1099:Extended precision 1058:Reduced precision 811:Binary search tree 676:Double-ended queue 460:Java ConcurrentMap 399:Class substitution 322:Graphic containers 1498: 1497: 1230:Associative array 1094:Octuple precision 943: 942: 745:Hashed array tree 644:Associative array 237:associative array 104: 103: 96: 67:quality standards 58:This article may 16:(Redirected from 1523: 1470:Type constructor 1355:Opaque data type 1287:Record or Struct 1084:Double precision 1079:Single precision 970: 963: 956: 947: 946: 768:Association list 600: 593: 586: 577: 576: 558: 557: 529: 514: 499: 493: 476: 408:(C/C++ language) 110:computer science 99: 92: 88: 85: 79: 53: 52: 45: 21: 1531: 1530: 1526: 1525: 1524: 1522: 1521: 1520: 1501: 1500: 1499: 1494: 1475:Type conversion 1410: 1404: 1340:Enumerated type 1313: 1199: 1193:null-terminated 1169: 1134: 1022: 979: 974: 944: 939: 926: 898: 792: 788:XOR linked list 754: 730:Circular buffer 711: 630: 609: 607:Data structures 604: 567: 562: 561: 546: 530: 517: 500: 496: 477: 473: 468: 441: 415:Type conversion 365: 355: 327:Widget toolkits 324: 261:Priority queues 211: 141: 100: 89: 83: 80: 73: 71:text is clunky. 54: 50: 43: 28: 23: 22: 15: 12: 11: 5: 1529: 1519: 1518: 1513: 1496: 1495: 1493: 1492: 1487: 1482: 1477: 1472: 1467: 1462: 1457: 1452: 1447: 1446: 1445: 1435: 1430: 1428:Data structure 1425: 1420: 1414: 1412: 1406: 1405: 1403: 1402: 1397: 1392: 1387: 1382: 1377: 1372: 1367: 1362: 1357: 1352: 1347: 1342: 1337: 1332: 1327: 1321: 1319: 1315: 1314: 1312: 1311: 1310: 1309: 1299: 1294: 1289: 1284: 1279: 1274: 1273: 1272: 1262: 1257: 1252: 1247: 1242: 1237: 1232: 1227: 1222: 1221: 1220: 1209: 1207: 1201: 1200: 1198: 1197: 1196: 1195: 1185: 1179: 1177: 1171: 1170: 1168: 1167: 1162: 1161: 1160: 1155: 1144: 1142: 1136: 1135: 1133: 1132: 1127: 1122: 1121: 1120: 1110: 1109: 1108: 1107: 1106: 1096: 1091: 1086: 1081: 1076: 1075: 1074: 1069: 1067:Half precision 1064: 1054:Floating point 1051: 1046: 1041: 1036: 1030: 1028: 1024: 1023: 1021: 1020: 1015: 1010: 1005: 1000: 995: 989: 987: 981: 980: 973: 972: 965: 958: 950: 941: 940: 938: 937: 931: 928: 927: 925: 924: 919: 914: 908: 906: 900: 899: 897: 896: 895: 894: 884: 883: 882: 880:Hilbert R-tree 877: 872: 862: 861: 860: 858:Fibonacci heap 855: 850: 840: 839: 838: 833: 828: 826:Red–black tree 823: 818: 808: 802: 800: 794: 793: 791: 790: 785: 780: 775: 770: 764: 762: 756: 755: 753: 752: 747: 742: 737: 732: 727: 721: 719: 713: 712: 710: 709: 708: 707: 702: 692: 691: 690: 683:Priority queue 680: 679: 678: 668: 663: 658: 657: 656: 651: 640: 638: 632: 631: 629: 628: 623: 617: 615: 611: 610: 603: 602: 595: 588: 580: 574: 573: 566: 565:External links 563: 560: 559: 544: 515: 503:data structure 494: 480:data structure 470: 469: 467: 464: 463: 462: 457: 452: 447: 440: 437: 436: 435: 434: 433: 426: 417: 412: 409: 403: 400: 397: 391: 388: 369:strongly-typed 354: 351: 323: 320: 319: 318: 313: 304: 299: 289: 288: 287: 286: 280: 269: 263: 258: 253: 210: 207: 199: 198: 195: 192: 189: 186: 183: 172: 171: 165: 159: 140: 137: 122:data structure 102: 101: 57: 55: 48: 26: 9: 6: 4: 3: 2: 1528: 1517: 1514: 1512: 1509: 1508: 1506: 1491: 1488: 1486: 1483: 1481: 1478: 1476: 1473: 1471: 1468: 1466: 1463: 1461: 1458: 1456: 1453: 1451: 1448: 1444: 1441: 1440: 1439: 1436: 1434: 1431: 1429: 1426: 1424: 1421: 1419: 1416: 1415: 1413: 1407: 1401: 1398: 1396: 1393: 1391: 1388: 1386: 1383: 1381: 1378: 1376: 1373: 1371: 1368: 1366: 1363: 1361: 1358: 1356: 1353: 1351: 1350:Function type 1348: 1346: 1343: 1341: 1338: 1336: 1333: 1331: 1328: 1326: 1323: 1322: 1320: 1316: 1308: 1305: 1304: 1303: 1300: 1298: 1295: 1293: 1290: 1288: 1285: 1283: 1280: 1278: 1275: 1271: 1268: 1267: 1266: 1263: 1261: 1258: 1256: 1253: 1251: 1248: 1246: 1243: 1241: 1238: 1236: 1233: 1231: 1228: 1226: 1223: 1219: 1216: 1215: 1214: 1211: 1210: 1208: 1206: 1202: 1194: 1191: 1190: 1189: 1186: 1184: 1181: 1180: 1178: 1176: 1172: 1166: 1163: 1159: 1156: 1154: 1151: 1150: 1149: 1146: 1145: 1143: 1141: 1137: 1131: 1128: 1126: 1123: 1119: 1116: 1115: 1114: 1111: 1105: 1102: 1101: 1100: 1097: 1095: 1092: 1090: 1087: 1085: 1082: 1080: 1077: 1073: 1070: 1068: 1065: 1063: 1060: 1059: 1057: 1056: 1055: 1052: 1050: 1047: 1045: 1042: 1040: 1037: 1035: 1032: 1031: 1029: 1025: 1019: 1016: 1014: 1011: 1009: 1006: 1004: 1001: 999: 996: 994: 991: 990: 988: 986: 985:Uninterpreted 982: 978: 971: 966: 964: 959: 957: 952: 951: 948: 936: 933: 932: 929: 923: 920: 918: 915: 913: 910: 909: 907: 905: 901: 893: 890: 889: 888: 885: 881: 878: 876: 873: 871: 868: 867: 866: 863: 859: 856: 854: 853:Binomial heap 851: 849: 846: 845: 844: 841: 837: 834: 832: 829: 827: 824: 822: 819: 817: 814: 813: 812: 809: 807: 804: 803: 801: 799: 795: 789: 786: 784: 781: 779: 776: 774: 771: 769: 766: 765: 763: 761: 757: 751: 750:Sparse matrix 748: 746: 743: 741: 738: 736: 735:Dynamic array 733: 731: 728: 726: 723: 722: 720: 718: 714: 706: 703: 701: 698: 697: 696: 693: 689: 686: 685: 684: 681: 677: 674: 673: 672: 669: 667: 664: 662: 659: 655: 652: 650: 647: 646: 645: 642: 641: 639: 637: 633: 627: 624: 622: 619: 618: 616: 612: 608: 601: 596: 594: 589: 587: 582: 581: 578: 572: 569: 568: 555: 551: 547: 545:0-201-82419-1 541: 537: 536: 528: 526: 524: 522: 520: 512: 508: 504: 498: 491: 487: 486: 481: 475: 471: 461: 458: 456: 453: 451: 448: 446: 443: 442: 431: 427: 425: 421: 418: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 385: 384: 383: 382: 378: 375: 373: 370: 364: 360: 350: 348: 344: 340: 336: 332: 328: 317: 314: 312: 308: 305: 303: 300: 297: 294: 293: 292: 284: 281: 278: 275: 274: 273: 270: 267: 266:Lookup tables 264: 262: 259: 257: 254: 252: 249: 248: 247: 244: 242: 238: 233: 231: 228:) or with an 227: 222: 220: 216: 206: 204: 196: 193: 190: 187: 184: 181: 180: 179: 177: 169: 166: 163: 160: 157: 153: 149: 146: 145: 144: 136: 134: 129: 125: 123: 119: 115: 111: 106: 98: 95: 87: 77: 72: 68: 64: 63: 56: 47: 46: 41: 37: 33: 19: 1334: 1255:Intersection 705:Disjoint-set 625: 534: 511:Online entry 502: 497: 483: 479: 474: 379: 376: 366: 325: 302:Linked lists 290: 245: 234: 223: 218: 214: 212: 200: 173: 167: 161: 147: 142: 130: 126: 113: 107: 105: 90: 81: 74:Please help 70: 59: 1485:Type theory 1480:Type system 1330:Bottom type 1277:Option type 1218:generalized 1104:Long double 1049:Fixed point 848:Binary heap 773:Linked list 406:Union types 394:Downcasting 316:Hash tables 256:LIFO stacks 251:FIFO queues 128:scenario. 78:if you can. 32:type theory 1505:Categories 1390:Empty type 1385:Type class 1335:Collection 1292:Refinement 1270:metaobject 1118:signedness 977:Data types 836:Splay tree 740:Hash table 621:Collection 466:References 357:See also: 84:March 2012 1465:Subtyping 1460:Interface 1443:metaclass 1395:Unit type 1365:Semaphore 1345:Exception 1250:Inductive 1240:Dependent 1205:Composite 1183:Character 1165:Reference 1062:Minifloat 1018:Bit array 892:Hash tree 778:Skip list 725:Bit array 626:Container 420:Templates 203:iterators 168:traversal 114:container 1490:Variable 1380:Top type 1245:Equality 1153:physical 1130:Rational 1125:Interval 1072:bfloat16 821:AVL tree 700:Multiset 649:Multimap 636:Abstract 554:34788238 439:See also 424:Generics 230:iterator 226:for loop 60:require 1433:Generic 1409:Related 1325:Boolean 1282:Product 1158:virtual 1148:Address 1140:Pointer 1113:Integer 1044:Decimal 1039:Complex 1027:Numeric 875:R+ tree 870:R* tree 816:AA tree 509:(2009) 505:in the 347:widgets 343:widgets 335:windows 331:widgets 162:storage 62:cleanup 1423:Boxing 1411:topics 1370:Stream 1307:tagged 1265:Object 1188:String 904:Graphs 865:R-tree 806:B-tree 760:Linked 717:Arrays 552:  542:  501:Entry 339:panels 296:Arrays 268:(LUTs) 148:access 34:, see 1318:Other 1302:Union 1235:Class 1225:Array 1008:Tryte 798:Trees 671:Queue 666:Stack 614:Types 488:. US 209:Types 120:or a 118:class 116:is a 1438:Kind 1400:Void 1260:List 1175:Text 1013:Word 1003:Trit 998:Byte 887:Trie 843:Heap 661:List 550:OCLC 540:ISBN 361:and 283:Maps 277:Sets 176:CRUD 156:FIFO 152:LIFO 112:, a 1297:Set 993:Bit 695:Set 482:in 422:or 217:or 108:In 1507:: 548:. 518:^ 337:, 232:. 221:. 205:. 135:. 969:e 962:t 955:v 599:e 592:t 585:v 556:. 396:; 97:) 91:( 86:) 82:( 42:. 20:)

Index

Container (data structure)
type theory
Container (type theory)
Container (disambiguation)
cleanup
quality standards
improve this article
Learn how and when to remove this message
computer science
class
data structure
programming languages
LIFO
FIFO
CRUD
iterators
for loop
iterator
associative array
Associative containers
FIFO queues
LIFO stacks
Priority queues
Lookup tables
Key-associated data structures
Sets
Maps
Arrays
Linked lists
Binary search trees

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑