top of page
Writer's pictureVikram Nayyar

Tuples and Records | Learning Data Structures with CompAndCode #5



Today we're going to be talking about Tuples and Records!!


This post will be a bit shorter given that Tuples and Records are simpler Data Structures, in comparison to ones like Trees, Linked Lists, Graphs …



Theory:

A Tuple is an ordered set of values.

Uses () to show what's inside a Tuple.

Elements can be of any Data Type, e.g. ("King",0,"a") would be acceptable.

Like String's, Tuples are immutable.

Tuple's are also static.


A Record is a collection of fields and each field holds its own data.

Records usually reside within tables/databases so each field within a Record should be kept atomic.


Implementation:

I will implement the Tuple Data Structure, showing a few examples of what is allowed and what isn't:



I will leave the pseudocode for the Record Data Structure below:


studentType = record

integer ID

string firstName

string surname

date dateOfBirth

string class

end record


As a challenge for you guys, lets see if you can implement this in a programming language of your choice?!?!?!

Final Things:

As always, thank you for making it this far, please leave comments, they help me so much. Be sure to like and share also, lets try and get 100 views within a week, like we have done previously. Follow CompAndCode on all platforms! Thank You Nibble Byte!!!



  • computerscience

  • code

  • coder

  • coding

  • codinglife

  • compandcode

  • computer

  • developer

  • html

  • java

  • javascript

  • machinelearning

  • programmer

  • programming

  • python

  • softwaredeveloper

  • softwareengineer

  • tech

  • webdeveloper

  • technology


114 views1 comment

Recent Posts

See All

1 comentario


Jamie
11 ene 2021

Nice recap on an important topic, thanks as ever!

Me gusta
bottom of page