Why adatatype is required for a node?

sir, when we write node class for a hashtable during implementation we use node means we are giving a datatype T to the node but sir node is a pointer to the head of the linked list and how we met a requirement to specify a datatype of a node…
please sir explain me its getting a bit confusing for me…

Hello @we_kaash

pointer will have some datatype right? like it might be pointed to char or int or another datatype here we need to mention the same type.

but sir when we implemented linked list and tree we did’nt specified any data type to the node

we havent made them generic , we always assumed that data will be int.

if we need to make them genric then in that case T placeholder and datatype is needed

so it means if we implement a class node and declare a pointer then by default it points to an integer till we specify its datatype?

no , we do mention the data while declaring the node

pls read about generic programming then only u will get some idea

1 Like

sorry sir, i have read it throughly but i need to revise the concept :sweat_smile: :sweat_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.