Today's Study(List)

in hive-161179 •  2 years ago 

Lists are generally divided into arrays and linked lists.

・arrays : Simply arranged data.
・Linked lists : Each data is connected by a pointer.(The pointer has an address to the next piece of data.)

There are various types of lists, but the following list with "Head" and "Tail" is the one that often appears in exams.
*Head" and "Tail" have a first and last pointer, respectively.

image.png

For example, if you want to add data named D0, store a pointer to D0 in "Head" and a pointer to D1 in D0, as shown below.

image.png

The reason I introduced lists is because you can represent a binary tree by a list!

Don't you see what's so great about it?
No, no, no, it shows that the rudiments of machine learning, "search", can be realized programmatically! It's amazing!

A practical example would be as follows.

image.png

From left to right are the elements Key, Parent, Left, and Right.
In order, we now have a list of information about yourself, your parent, this one on the left, and the child on the right!

It goes without saying that this allows us to have tree structures in lists, so operations are possible.

What do you think? Aren't you a little impressed?
I'm quite impressed : )

See you in the next Today's Study!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  


@neko9 さん、こんにちは。
@japansteemitがこの記事をアップボートしました。

tomoyan.witnessに投票お願いします👇

https://steemitwallet.com/~witnesses

💡 アップボートガイド 💡

分からない事は何でも質問して下さい🙇