Abstract
This chapter highlights the important role of data structures as a natural companion to algorithms. The premise is that computers can only store and operate on primitive data types, which essentially means just numbers; if we need another data type (e.g., to represent an image, or an email), we need to design it ourselves by enforcing a format on numerical data.
The running example used is that of strings, which in theory are just sequences of characters. Faced with a practical need to represent strings in memory however, a range of options exist. By examining two different string data structures and a range of algorithms that operate on them, various trade-offs in terms of efficiency are highlighted: ultimately, what seem be subtle or unimportant differences have a major impact.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The second option is sometimes termed ASCIIZ which sort of reads as “zero-terminated ASCII”.
References
Wikipedia: ASCII. http://en.wikipedia.org/wiki/ASCII
Wikipedia: ASCII art. http://en.wikipedia.org/wiki/ASCII_art
Wikipedia: Binary Coded Decimal (BCD). http://en.wikipedia.org/wiki/Binary-coded_decimal
Wikipedia: Bulletin Board System (BBS). http://en.wikipedia.org/wiki/Bulletin_board_system
Wikipedia: C. http://en.wikipedia.org/wiki/C_(programming_language)
Wikipedia: Pascal. http://en.wikipedia.org/wiki/Pascal_(programming_language)
Wikipedia: Programmed Data Processor (PDP). http://en.wikipedia.org/wiki/Programmed_Data_Processor
Wikipedia: “Schlemiel the painter’s” algorithm. http://en.wikipedia.org/wiki/Schlemiel_the_painter’s_Algorithm
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Page, D., Smart, N. (2014). How Long Is a Piece of String?. In: What Is Computer Science?. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-04042-4_4
Download citation
DOI: https://doi.org/10.1007/978-3-319-04042-4_4
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-04041-7
Online ISBN: 978-3-319-04042-4
eBook Packages: Computer ScienceComputer Science (R0)