Full Transcript

·YouTLDR

CloComp 2526 Hashing 1

1:07:45EnglishTranscribed Jul 14, 2026
0:01

Hello, good afternoon everyone. Eh, we

0:03

meet again for the lecture on

0:05

algorithmic complexity or algorithmic

0:09

complexity. In

0:11

this meeting, we will discuss

0:15

a concept that we know as

0:19

hashing

0:21

. especially we will see we

0:24

focus on why hashing is

0:27

important for eh computer science or

0:29

computer science and also some of the things that

0:33

make it have to be implemented or

0:35

applied considering ee maybe ee

0:40

traditional methods or methods

0:42

that have been ee old can not

0:45

speed up or cannot support the

0:48

process that will be carried out by computers

0:49

or ee machines yes.

0:53

ee especially for the retrieval area

0:57

where we have to input data

1:00

or store data, process it,

1:02

then also extract or

1:04

take out data from storage or

1:06

storage location. Okay.

1:12

Well, let's start with why hashing is

1:14

necessary. Well,

1:20

we know that especially in the

1:22

ee field, it was pulled by rivals

1:25

before, maybe it wasn't too clear

1:33

and

1:36

in the eh data

1:41

retrieval field.

1:43

So

1:44

what is the meaning of data retrieval? Eh, the meaning of

1:47

data is where we have to store

1:49

data, retrieve data, yes, remove

1:52

data from storage, how

1:54

to organize the data in memory or in

1:56

storage so that it can be

1:58

retrieved again to

2:02

see what information is in the data

2:04

. Yes. Em in the field of data

2:08

retrieval we can see that some

2:11

eh we call it traditional methods

2:13

or traditional methods

2:15

such as eh linear search or binary

2:19

search including binary search

2:23

have several obstacles to

2:28

storing or

2:31

extracting data from memory

2:35

a few weeks ago Then maybe a

2:36

few days ago you might have

2:38

heard or received information or received a

2:40

lecture about eh linear search

2:43

or binary search which what is it

2:46

called has time complexity or

2:50

the time to eh wait when the data is

2:54

extracted or issued is O yes

2:59

from e big o. Well, imagine if

3:03

you want time

3:05

complexity, time complexity,

3:09

time complexity.

3:13

Imagine with such time complexity

3:14

, you

3:17

try to search for example the

3:19

stored data or ee contacts,

3:22

e telephone contacts, contact numbers

3:25

stored in the ee phone book which are

3:28

not in sequence, right? What's more, this is

3:35

storage or a storage place

3:37

where the data here is not

3:38

sequential

3:41

. E,

3:43

well, if for example you want to look for

3:44

information to remove

3:47

from this storage place,

3:51

you automatically have to search or check

3:53

one by one, check one by one the

3:58

storage places or what is it called?

4:01

If this is considered like rooms,

4:04

you have to check

4:06

each room one by one to find the data

4:09

you want to extract or you

4:11

want to ee what is it called? Take it or you guys

4:14

look for it. This becomes very

4:18

inefficient, especially for

4:21

large amounts of data or large

4:24

sets. Because you have to

4:27

check each e room. Okay,

4:31

and so you have to

4:32

check one by one until the data

4:35

you want to search for is found,

4:38

so with this O time complexity, it is

4:41

very inefficient for large data types

4:44

.

4:48

Then the binary search which has a

4:50

time complexity of O logarithm of N, yes,

4:55

this is indeed what is it called, eh, it is

5:00

faster than O eh N because

5:03

it is the logarithm of N. only

5:06

research requires data to be

5:11

sorted.

5:14

It requires that the data we want to

5:17

extract is in sequential

5:22

or sorted form.

5:26

And it is indeed faster than what

5:28

we had before in linear

5:30

search. But the process of sorting

5:34

data, if you calculate the time

5:38

complexity,

5:40

is also quite expensive just for

5:43

sorting the data, not to mention extracting the

5:46

data. If you extract data from data

5:48

that has been sorted or ordered, it is

5:51

indeed fast. But the process for us

5:54

to sort the data is what we consider to be

5:56

more expensive or more costly

5:59

in terms of time and effort or eh

6:04

computational

6:07

.

6:09

So the time complexity is quite high

6:12

and the competitive cost is quite high

6:14

too.

6:16

Well, one of the techniques that was

6:20

developed is what is it called?

6:24

To overcome this problem is

6:27

binary search 3 which changes or

6:33

what is called has a time

6:35

complexity between O log N to

6:38

ON. only at

6:42

certain times, in the worst case scenario,

6:51

it

6:53

can make the time return to O

6:56

eh to ON. Well, the

7:00

worst cases where the time or time

7:02

complexity is UN are often

7:05

caused by the size or shape of the

7:09

tree or data being unbalanced

7:13

or the data being unbalanced.

7:18

What do you call it? If you understand

7:21

the shape of three, the shape is like

7:24

this graph, right?

7:29

like this, each one has an

7:32

eh age and eh notes, where the notes

7:36

have children or parents or

7:39

parents.

7:40

Well, for example, if it's unbalanced,

7:42

what's it called? It's

7:47

not balanced, for example, if this

7:49

is the starting point, then we

7:53

call it ROT.

7:57

If the root end is there,

8:00

we can see that in that trigon

8:04

, there

8:05

is an imbalance

8:08

between the right position and the

8:10

left position, where the search process

8:13

in the left position will definitely

8:16

take a long time because it has to

8:18

go down to the roots to

8:21

get the

8:23

desired data. So, if the

8:27

desired data is in a position

8:29

like this, it automatically has to

8:31

walk or explore to the very

8:33

root.

8:36

Or even worse if

8:38

the data is actually on the

8:41

right. That meant he had to

8:43

explore the entire left position

8:45

first. Well, before finally moving to

8:48

the window on the right to

8:50

get the data, okay?

8:53

In fact, if we have a

8:55

smart enough mechanism

8:57

for this free binary search, we

9:00

can, if we already know the position of

9:02

the data on the right, automatically, maybe

9:07

we can,

9:09

what is called, eliminate the

9:10

search process on the left

9:13

. So for balance 3, it is

9:16

still an obstacle when we

9:20

carry out the data retrieval process or

9:23

eh data to take data from

9:26

storage.

9:29

Here we already have a

9:31

demand or request because if we

9:35

look at the current process of receiving data

9:40

or creating data, it is very

9:42

fast.

9:43

Moreover, with the term big data

9:48

, the term big data means that the

9:51

volume of data is already very large

9:54

. Hopefully so that we need

9:57

eh what is it called? Explosion of data,

10:00

yes. Data grows

10:02

exponentially once in an exponential graph,

10:08

yes.

10:09

Then we need a

10:11

method or technique or whatever way

10:14

it is to

10:17

make ee what is it called data search

10:20

or data receiver, data extraction

10:22

more efficient,

10:26

precise and access is more eh scalable

10:30

can be developed or ee what is it

10:33

called can be

10:37

multiplied. Please provide it based on

10:41

data growth or development.

10:47

Okay. Well, let's see now what

10:49

haing is, okay? Hing is a technique that

10:53

transforms or changes input data.

10:57

Usually the input data is in the form of an

11:00

integer or string. Suddenly

11:04

you understand the data. Change the input data,

11:07

yes. input

11:10

input data is a fixed value

11:13

or

11:14

fixed size value, a

11:18

fixed size value,

11:28

usually in the form of an array or

11:30

integer

11:35

that represents the

11:40

original data that you have or that

11:42

you want to hash the presentation

11:49

. So once again, hashing is a

11:51

technique used to transform

11:54

or change input values ​​into

11:58

fixed size values. Oh, sorry, fix the

12:02

size value. ee fixed values

12:07

that represent your input values

12:09

yeah. Well,

12:13

ee these fixed values, yes

12:16

these fixed values ​​or

12:18

this size value, we usually know

12:21

it as eh usually we know it as

12:25

ee

12:29

sor

12:34

we can call it

12:42

Well,

12:44

later this high code will be used

12:47

as an index, as an index,

12:51

yes, to store and receive data

12:54

effectively and efficiently, yes. So

12:58

remember, hashing is a

13:00

technique to transform input values

13:03

into fixed size values ​​that we know as

13:06

has codes, which are later

13:09

used as indexes to

13:11

store and retrieve data

13:14

efficiently.

13:16

Make sure eh what's the name? Imagine

13:18

you have a

13:21

locker, for example at UKIM there is a locker.

13:24

Of course, each locker has a

13:26

eh, what is it called? Different key combinations

13:29

. Yes, if you want to

13:31

receive or take items from

13:33

the locker

13:35

, of course you will not open

13:36

each locker individually. You

13:38

just go to the locker number that has been

13:40

indexed, locker 1, locker 2, 3. Then

13:43

just open the locker, okay?

13:48

with the codes that have been

13:51

provided, yes. Well, how does

13:55

hashing work?

13:59

So, to change the input data

14:01

into a

14:04

hash code, there is a function that will be

14:07

applied to the input value.

14:11

For example, if we have the word "

14:16

apple" yes,

14:18

apple may be the result of the function

14:23

from the function that has been implemented or

14:24

created,

14:27

this apple is then changed to a

14:30

fixed size value or coded to have a value of

14:32

5 yes.

14:35

Well,

14:38

then these five are stored in what

14:42

we call a hash table.

14:45

So, the hash table is an array

14:50

that is used to store the index

14:54

of the high score,

14:59

taking the index of the high code

15:02

.

15:04

So, from there to uh uh

15:08

what's it called? Storing the H code

15:12

requires a trivial insertion process

15:16

to the hash table.

15:20

So if we want to store eh

15:25

Apple for example or appel appel yes

15:28

into the has table, we enter index

15:31

number 5 into the table. Then,

15:33

if we want to

15:35

extract the word apple, we go to

15:39

index number 5 and then we extract

15:43

the information e about the apple.

15:48

Well, with a mechanism like this,

15:51

it is not impossible for a mechanism like this to

15:55

happen, eh, what is it called,

15:58

what we call collusion.

16:01

Yes, what is collusion?

16:03

Well, collusion is a data collision.

16:05

In Indonesian, collusion is

16:07

like a collision, right?

16:10

Well, maybe eh when we hash eh the

16:14

apple it outputs the value H5

16:18

according to the function we already ee what is it

16:21

called? the functions we create. But

16:24

for example, if we take

16:29

bananas, for example,

16:32

bananas, perhaps with the

16:35

same function, they issue index 5

16:38

so that a collision occurs between the

16:41

apple storage area for storing

16:43

apples and this banana. Well,

16:47

there are two

16:50

most commonly used mechanisms to avoid

16:53

or handle this collusion.

16:56

The first one is

16:58

caning or in Indonesian,

17:01

chain. That will store the values

17:06

of ee apples and bananas into a

17:11

sort of list.

17:13

So in a typical table there will be index

17:18

5. Well, index 5 has a value

17:21

or has the value of apples, comma

17:27

bananas

17:28

. So if

17:31

this function's special function or this special function

17:34

returns the same value that already

17:36

exists or is owned by the previous data ee

17:38

, it will still insert the

17:40

new data according to the existing ee index

17:45

into a list. There

17:48

may be others that will be

17:50

saved to make the list longer.

17:53

Well, that's the first way. The second way

17:55

is to use the term open

17:58

addressing.

18:01

Well, this open addressing will

18:03

try to find an empty slot, the

18:06

next empty slot by exploring

18:11

the table. So, for example, if the

18:13

index number 5 is already filled by the

18:15

apple, then the banana will also

18:18

contain the number 5, then it will look for an

18:22

empty index or an empty slot to

18:24

store the banana data. Maybe

18:26

index number 6 is where to place

18:31

ee what is the name of the data regarding bananas.

18:34

Well, the choice of technique between

18:40

these hashing methods really determines

18:43

how effective

18:46

and efficient hashing becomes.

18:48

Again, this is a case by case basis

18:50

. If it is to choose when it is suitable,

18:53

choose the opening when it is suitable,

18:55

determine the effective or

18:57

efficient way to determine how to use

18:59

hashing effectively and efficiently.

19:02

yes.

19:04

Well, the implementation or application

19:06

of this hashing is

19:10

actually

19:12

very widely applied in the world of

19:16

databases and indexing

19:19

. To query data

19:22

quickly, an index is usually used from the

19:26

database used to

19:29

store the data.

19:31

Then in cryptography

19:34

to

19:36

guarantee the security and integrity of the

19:38

data,

19:40

yes. Then there are lots of hashings

19:43

used because they are a

19:45

basic concept for storing and receiving

19:48

or outputting data.

19:51

Yes, even so, it is not without

19:54

challenges, Racing also has

19:56

some

19:58

limitations or weaknesses. One

20:01

of the things that could have happened earlier is collusion

20:04

. Then how is the function of

20:08

this hashing developed.

20:11

If the function is good or strong, it

20:14

might indirectly

20:15

reduce collisions too. Okay.

20:21

Well, that's about the meaning of

20:24

hashing.

20:26

Okay. Eh, one of the functions that is quite eh

20:30

sorry one of the aspects that we learned

20:33

from the previous slide is the has

20:35

function.

20:36

This is an important aspect when we want to

20:38

process data with hashing.

20:44

Eh, as explained,

20:47

this has function is a function.

20:51

This function changes the input data.

20:55

N so if there is input data, we

20:57

apply the function then it

20:59

will become a

21:01

fixed

21:03

size value. What does it mean, eh, what is the value or value

21:07

called? We still hope

21:11

that the value remains automatic when

21:14

we perform a query or want to retrieve

21:16

data,

21:18

so the time complexity is close to or

21:20

similar to O1.

21:23

This is the time complexity which is

21:25

independent of the size of the dataset.

21:28

So, even if the data set is large or

21:32

small, if all our queries or eh

21:35

information retrieval that we do

21:40

are close to the time complexity

21:43

or sorry all 1, it is close to ideal.

21:48

Okay.

21:51

So,

21:53

what's it called?

21:55

Uh, this has function has

21:57

functions that are very important.

22:00

Among them, as already explained,

22:02

it makes data retrieval or

22:06

data retrieval and accessing or

22:08

searching for data more efficient

22:11

or in other words, increases

22:14

efficiency

22:16

in accessing data. Okay.

22:21

Oh, it's just a

22:23

coincidence, sorry. Then it also

22:26

supports data structuring. Because

22:28

by accelerating, we change

22:32

our input into a hash which

22:34

will later or eh

22:37

hash code, it will make our data

22:42

more organized,

22:44

well organized so that it

22:47

minimizes the search time, which

22:51

of course is very useful when ee

22:54

what is the name of ee our data is in the form of a

22:57

very very large or large data

22:59

set.

23:02

Then it also increases security

23:04

because this has function is often used

23:06

to guarantee or make data more

23:10

integrity

23:12

and more authentic.

23:17

Hmm.

23:19

So, to make has functions that are

23:22

more robust or oh wait, more

23:26

robust or more, ee, what do we call it

23:30

, robust or tough or strong

23:33

, solid, sturdy, the term is

23:39

sturdy, ee, the ideal function, right?

23:42

What is the ideal function like?

23:44

The use of the ideal function must

23:46

guarantee that the

23:50

data that we distribute

23:52

is ee un uniform or

23:56

distributed ee evenly.

24:00

So when we apply the has

24:03

function,

24:06

okay, the

24:08

result we get is the result that is

24:11

issued by the has function in the form of a

24:14

has code,

24:16

or we call it has, or

24:18

hash value. whatever it is, it is spread

24:21

evenly in the hash table

24:28

or special table, yes. So if we

24:31

have the input earlier, if in the

24:33

previous slide we input it, we use the

24:34

function to produce the has code, right?

24:37

This H code will be stored in the

24:41

hash table.

24:43

So, if the distribution of the keys is

24:45

even in the has a table,

24:49

it indicates that our has function

24:52

is an ideal has function,

24:55

which is good, as expected.

25:00

Then the second indicator is when there is

25:02

a little collusion,

25:05

yes. If the collusion

25:09

generated by these functions is

25:11

small in number or rare,

25:15

it indicates that our H functions

25:18

are designed ideally. Well, so

25:21

pay attention to these two indicators. Uniform

25:23

key distributions and collision

25:25

resolution methods indicate or

25:28

are indicators of whether our H function is

25:31

optimal or not.

25:39

Eh, then how do we

25:41

implement the

25:42

has function study? Has function

25:45

as we know

25:48

is a function. So

25:51

whatever mathematical operator you want to

25:52

use as long as it is a

25:55

function and produces an output, that is the

26:01

output, the hash code.

26:04

We can categorize it as a

26:07

hash function. So that's a function,

26:09

yes, an arithmetic function. Okay, one of the

26:13

simple arithmetic functions that

26:14

we usually use for the

26:17

simplest hash function

26:23

is modular hashing or

26:27

modulus-based hashing.

26:34

What modulus modulus? The modulus is the remainder, right?

26:36

remainder for. For example, if ee 5 modulus 4

26:41

means it is equal to 1. This means the remainder of

26:44

5 and 4 is 1. 7 modulus 3 is

26:50

also 1 because the result of dividing 7 by 3 is 1.

26:54

If 7 modulus 4 means

26:58

3. This means the remainder

27:01

is 3. Yes, that is the meaning of ee

27:05

modulus.

27:06

Well, eh, the simplest of the H

27:10

functions,

27:11

the simplest H function

27:13

that we can quickly use is the

27:16

modulus based on eh, sorry,

27:19

modulus-based modular hashing which is usually

27:22

indicated or

27:24

represented written as

27:27

this percentage, right? So ee with the

27:31

hash formula our input value.

27:34

we put the modulus of the size from the table.

27:39

So, what table? This is the size of the

27:44

hash table.

27:48

Well, has tableemic eh sor selection of

27:51

size from this table depends on eh

27:54

individual choice. For example,

27:57

I choose the has table of 16.

28:01

So, if for example we

28:02

apply this function,

28:05

we apply this function for the

28:07

hashing process, for example, we

28:11

want to hash the number 10 so we write

28:15

hash 10, yes, it is the same as 10 modulo or

28:22

modulo of 16, the size of the table is equal

28:25

to

28:27

10, yes, the remainder for it

28:31

or hash

28:34

ee 26, yes, it

28:37

means 26

28:40

modulo

28:41

of 16 is 10 too.

28:46

hash. Another example is 42, for example

28:51

42

28:53

modulo

28:55

17, eh sorry, modulo 16

28:59

= 10. So the remainder for the module is the

29:03

remainder for the division. So you can use

29:04

this function

29:07

to ee using

29:11

ee used as a hash table.

29:14

Well, if you look at it, oh

29:19

my, the selection of a simple function that is

29:21

quite simple will

29:23

cause

29:24

me to change the color, it

29:29

will cause this, what is it called? There are lots of

29:32

collisions like the example

29:35

we just saw, there are 10 10 of these.

29:39

This will produce the same has code

29:41

or in other words its function is

29:44

to produce ee which is quite easy to produce

29:48

collusion.

29:50

Although collusions like the ones

29:52

we heard yesterday or some of the previous slides

29:57

can be overcome or handled

30:00

with two methodologies, namely caning and

30:03

open dressing. But still, if you have a

30:06

lot of collusion that occurs,

30:08

if a lot of collusion

30:10

occurs, of course this process will also

30:12

take time, thus increasing the

30:14

processing time. Ha, and so

30:18

if we think that less

30:20

collision is better. If we

30:22

have a lot of collisions, that's something

30:24

we don't expect. And many

30:26

collisions that occur could be

30:28

caused by the selection or

30:31

design of the hashing function

30:33

not being optimal or not good.

30:36

Well, in this case, because the design is

30:40

very simple, the formula is very

30:42

simple, that's why collusion can easily occur

30:45

. Okay. Well, one trick

30:49

to reduce collusion is choosing the

30:53

table size. The size of this table,

30:57

according to arithmetic, is

30:59

better to use prime numbers

31:03

. 17

31:06

23 is a prime number, right? Because with

31:10

prime numbers, the modulation process

31:14

will often, eh, so it will rarely

31:16

result in collusion occurring. There are still some,

31:18

but not as many as

31:20

if the table size selection is not a

31:23

prime number.

31:30

One more thing, eh, for example,

31:34

ee oh yes, eh, the limitation or limitation or

31:39

weakness of this modular hashing is

31:43

because of its simple nature, the formula is

31:45

very simple,

31:47

the distribution of the ee key in the

31:51

table is very bad, not very

31:54

good, yes, it has the same pattern,

32:00

yes.

32:01

Eh, sorry or ee if for example Q,

32:05

these Q values ​​have the

32:08

same patterns, ee, it

32:14

will probably produce numbers that are not

32:16

evenly distributed.

32:21

Okay. So, ee because

32:24

basically this formula is a

32:26

simple formula, right?

32:28

So the distribution of numbers is uneven.

32:31

Even though the

32:32

uniform key distributions

32:36

from the previous slide are an

32:37

indication or are the

32:40

most important or primary thing in the

32:44

hard function.

32:46

Then the second limitation is or the

32:48

second weakness or the second deficiency

32:49

is clustering.

32:52

Well, this clustering occurs when

32:54

some groups become or slots some

32:58

slots or groups

33:01

become full so that it reduces

33:05

performance

33:10

reduces

33:13

performance.

33:20

Well, the ee slot is

33:22

full,

33:26

the slot in the table becomes full so that it

33:29

reduces performance when we

33:31

do queries or searches.

33:37

What is the name for improving the simplicity

33:41

of this modular haing? Usually

33:44

we develop more

33:46

complex functions that are quite advanced.

33:49

Oh wait a minute.

33:51

One of the advanced ones is that

33:54

we can use the

33:57

harsh murmur.

34:01

Well, this is a more complex function process

34:04

using arithmetic

34:07

or a more complex function

34:09

so that it

34:12

reduces or reduces collusion

34:15

and makes the distribution of Q

34:18

more even.

34:23

So, next, let's look at

34:26

collisions, OK? Eh, this collision, eh,

34:30

collision is almost impossible to

34:32

avoid in hashing, right? in

34:35

terms of hashing.

34:37

Eh in the hashing process especially we ca

34:39

n't nearly avoid

34:41

collisions. Our only goal is to

34:44

reduce the occurrence of these collisions.

34:47

Well, trying to make sure that the

34:50

coalition happens at least. So, when we

34:54

try to reduce the ee, suppress

34:57

the level of collisions or when

35:01

the collision occurs, yes, when the collision

35:03

occurs, there are two mechanisms to

35:07

handle the collision, yes. There is something

35:10

we call chaining

35:13

or chains

35:15

or chains, chaining.

35:19

E wait a minute I

35:21

or the second method is eh open

35:24

addressing

35:29

eh

35:33

ah wait a minute open addressing

35:42

open addressing which is open

35:45

addressing which

35:49

applies the technique of applying the rehearsing technique

35:58

can also be used

36:01

to implement the

36:03

ee rehousing technique, yes. So, if

36:08

we choose chain, the chaining method, well, the

36:13

mechanism is in

36:16

the previous slides,

36:19

I briefly mentioned what

36:22

chain and open tracing are. If it's a chain, it

36:25

will make the index into a

36:30

link list. So the list is related

36:33

to each other elements.

36:36

to save ee data that ee

36:41

collides with, what is the name of the has code?

36:46

For example, if

36:50

we try to use this function,

36:54

the easiest way to

36:56

cause a collision is the modular function.

36:59

If we want to have a function value of eh 12

37:03

for example, with what is it called ee

37:09

what is it called em modulu ee the size of the table is

37:14

5 for example,

37:16

so the Q is 12 we modulo it with

37:19

the size of the table 5 yes, the result is the

37:22

has code 2 yes, if we for example

37:26

want to hash 22 yes 22 modulo of

37:55

the size of the table 5 yes, that is also du well this is an example of two what are the names of two what are the names of two keys that collide or become a collusion well with this C method yes before when we enter the values ​​where we enter the values ​​we enter the values ​​into the has

37:57

table

37:58

Well,

38:01

for example, suppose this is a hash table index

38:03

that two will contain a link list or link

38:08

or list whose elements are what are they

38:10

called ber ee related berlink yes it

38:15

eh

38:17

contains the

38:19

first link list maybe 12 yes because the

38:22

result of the module is 2 then

38:25

goes to 22 yes. Later, if there is another ee key

38:29

whose module is 2. For example,

38:32

in the slide there are 32 and

38:35

so on until the list is

38:38

full.

38:41

Okay. Well, this is the table that is the

38:43

hash table if we use the

38:46

chaining mechanism. If we

38:50

use the chaining mechanism

38:53

to handle collusion. Okay.

38:58

Well, it's like this. Well, the advantage

39:01

of this chaining method is that it is

39:03

simple, easy, so it is easy to

39:06

implement

39:08

.

39:11

Ah, the hope is that if for example there is

39:12

not too much collusion, yes, it

39:15

doesn't happen too often,

39:17

this CN method is more

39:21

desirable or better to use

39:24

because it is simple and easy to

39:26

implement.

39:29

But the downside is that if there is

39:31

a lot of collusion, then

39:35

this link list will become longer

39:39

. This link will be longer,

39:41

which because it is longer automatically

39:43

results in a longer search time,

39:46

so

39:48

the retrieval is quite long and

39:52

with this chaining method, when we

39:55

want to use the link list, it

39:59

requires quite a

40:03

lot of memory. We have to prepare the memory

40:05

to prepare the link list

40:06

. So, one of the drawbacks is

40:10

higher memory usage.

40:12

Quite high memory usage.

40:17

Okay.

40:19

Well, the second method, what's the name of it,

40:24

that we can use for collusion

40:26

is eh, open addressing, right?

40:32

open tracing, which

40:35

can also

40:38

use

40:40

re-hashing

40:45

rehashing techniques. Okay. Well, ee, by definition

40:51

or simply put, this open opening

40:55

is looking for an empty slot

41:01

to fill the colluded

41:05

or collided data. It looks for the next

41:08

available slot or empty slot in the

41:11

hash table to fill with the

41:14

colluded data. Well, one way

41:17

to

41:19

find that slot or empty slot

41:21

is to apply

41:24

another rehearsing function or

41:28

another rehearsing technique. So, for

41:31

example, when uh 12 modulo 5 earlier it

41:37

produced 2 then 22 modulo 5 earlier

41:42

produced 2, yes, in the has table, index

41:46

number 2 is filled with the first one,

41:48

uh 12.

41:52

Now, for 22, what is the name? Eh,

41:57

with the open addressing method, it will

41:58

look for an empty slot after the

42:01

empty slot slide in the hash table

42:03

to be filled with the value 22. Maybe

42:05

after doing the search, it will be

42:07

here. The index doesn't know what number it is,

42:10

maybe 21, but it contains the value of 22

42:14

hashes. Okay and so on.

42:17

Well, this search is what we

42:20

know as rehearsing

42:22

. This rehearsing will also be called

42:26

rehassing, yes, or hashing that is done

42:29

again or repeated hashing, of

42:32

course it is a function again, yes. So

42:36

here we will use the second function to

42:39

look for the next ee index which is

42:42

empty.

42:45

we can use

42:49

other functions or we can use a

42:51

short technique, a simple technique,

42:52

for example linear, yes. For the reheing process

42:57

we can use linear. So,

42:59

maybe after filling in the value 12 in index

43:02

number 2, when we found

43:08

the collusion with the number 22, it turned out that

43:11

index number 3 was empty.

43:14

It could be because we filled 30 with 22.

43:17

Well, this is linear.

43:20

Well, what is he just looking for? He searches

43:22

sequentially for empty sequences. The

43:25

next empty slot sequence is immediately filled

43:27

with the colluding index.

43:31

Or we can also search with

43:35

certain intervals.

43:38

for example, from two, yes, to

43:42

store the number 22,

43:45

is it not just eh sorry, not looking for

43:49

what the next empty slot is, but the

43:51

empty slot, ee, is a multiple of two, so 2 4 6,

43:56

then the empty one will be

43:58

filled with 22, yes, something like that is

44:02

called quadratic, yes, so for those who are

44:06

rehearsing this, yes. For

44:11

this reheing process, we can use

44:15

linear to search for

44:17

empty slots sequentially

44:19

or in order. We can use

44:21

quadratic

44:23

probing linear probing for

44:26

sequential ones. Then quadratic probing

44:29

to search quadratically

44:31

based on certain intervals,

44:33

yes.

44:35

yes. Or we can also use

44:39

double hashing

44:41

or reharsing, namely using the

44:44

next function, the second function to

44:46

search for empty slots.

44:48

Okay.

44:52

Well, the advantage of using

44:56

open addressing is that it doesn't

45:01

use up too much memory. Doesn't

45:03

take up too much memory. So

45:06

what is the name of the space we use?

45:09

what's wrong? No, not much like

45:12

if we use chaining. But

45:18

there is a big possibility that clustering will occur

45:21

. The possibility of clustering occurring exists

45:23

because we, after searching,

45:26

for example, use double hashing.

45:28

Well, it turns out that the second function

45:31

also finds a slot that is already

45:34

occupied, so another collision occurs

45:37

. Well, that's clustering,

45:40

right? Well,

45:43

choosing which technique we want to

45:46

use really depends on

45:48

each case. We'd better

45:51

use a chain when, yes, in

45:55

our case, there are a lot of

45:58

changes. If there are a lot of

46:00

deletions,

46:03

it is better to use

46:06

chaining because if it is deleted,

46:09

for example, the link list will

46:10

be empty, so it is faster and takes

46:13

up less memory. But

46:17

when our memory is limited,

46:21

yes, our memory is limited, it is better

46:23

to use rehearsing or open

46:25

addressing

46:28

.

46:34

Well, in the open addressing technique

46:38

to overcome collusion, we

46:41

briefly looked at linear

46:43

probing and quadratic probing. Well,

46:50

these are two techniques that are also used if

46:52

we choose the open addressing technique

46:54

apart from the rehearsing mentioned

46:57

earlier.

46:59

Um

47:01

yes, if linear probing is as

47:03

explained earlier, searching for slots

47:05

sequentially, searching for cost slots

47:07

sequentially or

47:09

sequentially. Well, that automatically makes

47:13

this technique simpler

47:16

to implement quickly and

47:18

easily. Besides that, because

47:21

the data is sequential, the

47:28

performance is good for case by case.

47:31

Sequential access

47:33

always makes the case performance

47:36

better, right? Apart from that, it is also

47:40

efficient with memory, it doesn't

47:43

require

47:47

additional memory, it doesn't require

47:49

additional memory structures. Okay.

47:52

Well, but the downside is that there

47:54

could still be a clustering risk or a

47:57

tendency for EE to form clusters, yes,

48:02

that still exists and the high tendency is for

48:07

what? the cluster that occurred was still

48:09

high. So if clustering

48:11

occurs, it will result in ee ee

48:17

longer, what is it called?

48:21

What is this Longer called? Ee

48:25

ee ee

48:28

searching. I'm looking for the

48:30

Indonesian version. Search. Long search

48:32

. Remember the search. So remember, eh, the

48:36

linear probing technique and the quadratic

48:38

problem technique, eh, the quadratic problem probing, the

48:41

function or purpose of this is to

48:44

find empty slots, right? empty slot

48:49

search

48:52

empty slot search because of

48:54

collusion or collusion. Well, if

48:57

clustering occurs in the hash table, the

49:01

slot search in the H table will take

49:04

longer. So if the slot search

49:06

takes longer,

49:08

automatically when we do a

49:12

retrieval, it will increase the

49:13

search time too.

49:17

Well, it's different from quadratic probing

49:19

, its advantage is that it tries to

49:23

solve the clustering problems

49:25

that exist in linear probing. So,

49:27

rest clustering makes

49:31

the data more uniform,

49:34

the data is distributed fairly evenly, and the

49:37

spread is better. If we look at eh

49:41

good hashing is if eh uniform

49:44

ski distributions yes. So if the data is

49:47

evenly distributed, it indicates that

49:49

our hashing is optimal.

49:54

But it is

49:56

quite complex to have limitations

49:58

that must be what are they called? It is filled

50:01

before we use

50:04

this quadratic probing,

50:07

okay? such as load vector limitations.

50:11

If the load vector exceeds the threshold

50:13

or exceeds a certain limit, the

50:15

quadratic problem of quadratic

50:20

probing becomes a problem. Okay. So,

50:23

when do we use linear? When do

50:25

we use what is it called?

50:29

This is quadratic probing. Yes,

50:32

we use linear probing if, for example, our conditions

50:35

are

50:36

suitable for us to look for

50:38

simple things

50:40

that are easy. Simple and easy.

50:43

Then also if we prioritize the case

50:48

, prioritizing case performance,

50:51

we prioritize case performance

50:55

and the load factor is low.

51:04

low load

51:07

or low load low load factor yes. So

51:12

if our priority is simplicity and cash

51:15

performance, then it's better

51:19

to use linear probing.

51:25

But if

51:28

our main goal or priority is to

51:30

reduce clustering, then it's

51:32

better to use a

51:36

quadratic problem, to

51:40

reduce

51:41

the number of clusters, reduce the number of clusters, and the

51:46

loot factor, what's the name? It's

51:50

high.

51:55

high vector loot. Well, it's better to

51:58

use quadratic probing, yeah.

52:02

So, once again, if we

52:04

use linear probing,

52:06

we should prioritize simplicity

52:09

and cash usage, and one of

52:12

the indicators is that if our load factor is

52:14

low, we can immediately use linear. But

52:17

if the load factor is high, we

52:19

immediately use quadratic because it can

52:22

reduce the clusters that occur.

52:28

So, we saw earlier about open

52:30

addressing. Now we see that it

52:32

becomes eh we see separate chaining

52:35

or just chaining is actually often

52:37

called that, right? Yes, it has been repeated

52:40

many times regarding the use of

52:42

this chaining. We use a linked

52:44

list, yes. So for the hash table there is an

52:47

index. Then the second column of the hash table

52:50

is a linked list. Well, if the

52:53

link list is 15, then if the key is 15, that

52:57

means the hash value is 10, right?

53:02

For this link list, it occupies an

53:05

empty index, right? So, for the

53:08

data search or retrieval process,

53:10

we only

53:13

go to the ee index of the hash table

53:15

. Well, the processes that occur

53:18

in chaining clearly

53:24

require an insertion or

53:26

data entry process. Yes, for example, if we are

53:29

after the H table, we have to enter

53:32

the em key along with what the link list looks

53:37

like. If the

53:42

so-called link list is not yet

53:43

available, we just enter it directly.

53:46

If the key is not yet available in the

53:48

table, in the hash table, we just

53:50

enter it directly. But if the key is already

53:53

available in the hash table, then we

53:55

form a linked list because that means

53:58

collusion has occurred.

54:00

Well,

54:02

then there is a search process

54:05

in the hash table itself using the

54:08

link list method. So, if we want to

54:11

retrieve data, we have to do a

54:13

search process first to see which index our data is

54:15

at.

54:18

Yes, that's why, for example, if the

54:21

link list becomes longer, the

54:22

search process will automatically take longer.

54:25

Well, automatically a lot of collusion occurs,

54:29

right? If it's a link, if the link list

54:32

becomes long, it's usually long,

54:35

that's an indicator that there's

54:36

a lot of collusion, so you have to

54:39

fix the function, the hash

54:41

function. Because a good has function

54:43

should not

54:47

have many collusions, right?

54:51

Then there is delation. So,

54:52

if there is a

54:54

data change, the data is deleted, that

54:57

means it will remove

54:58

one of the values ​​in what is

55:02

called the

55:04

hash table. If for example

55:08

the ee link list only has one element and

55:10

that element is deleted, what does the index mean,

55:13

for example, what is it called?

55:16

At index 1, the only Q that exists is

55:19

21. When 21 is deleted, it means that the boarding slot eh 1

55:24

has index 1, which means it is an empty slot,

55:28

right?

55:32

Well, what's the name for?

55:35

eh chaining.

55:38

Well,

55:41

besides the simplicity of

55:44

chaining, it is simple and easy

55:47

to implement, so it is interesting

55:49

to implement it straight away. C

55:53

also has several shortcomings, as

55:56

we have seen in the previous slide,

55:58

namely that chaining requires a

56:01

lot of memory. So when we

56:05

choose to use a

56:07

training method, make sure we also have a

56:09

large enough memory. Why?

56:12

Because every element in the links,

56:15

eh, every element in the link list

56:17

in the has table, yes, it

56:21

definitely requires memory for pointers.

56:24

So if our link list is

56:25

long, our link list is long, it

56:31

will automatically take up a lot of memory. So,

56:35

this link is long and will take up

56:38

memory. Thus, the search time

56:40

will also increase significantly

56:45

. If time

56:47

increases, it will automatically have

56:50

an impact on performance.

56:53

performance or ability to

56:56

perform searches.

56:58

Well, eh cashing also has disadvantages,

57:02

especially in terms of eh cash performance,

57:07

yeah. maybe the link list might

57:10

experience pur eh have a

57:13

performance case that is not very good

57:17

because ee

57:20

ee the memory allocation is not

57:22

continuous, not sequentially yes.

57:27

For example, ee,

57:30

where was that on the previous slide? Um, wait

57:35

a minute,

57:41

ee,

57:43

this is for example,

57:47

for the one earlier, it seems like there was a

57:50

table that was quite long, but there wasn't one, right?

57:55

Oh okay.

57:59

For example, for the key value index

58:02

number 2,

58:05

what is the name of the circle? This is 20 12 22

58:09

32, not sequential, there

58:12

are still 13 14 15 and

58:14

so on, so that if for example the

58:16

storage is not sequential and

58:18

not sequential,

58:20

unordered storage like this or non-sorted,

58:22

it will take up memory and will also

58:27

reduce the search time too, right? So

58:30

that's the

58:32

drawback of what's it called ee

58:38

ee what's it called ee chain yeah.

58:42

CAS performance is a

58:44

fairly classic problem when we choose what is

58:48

called chaining. That's why it was

58:51

resolved with open addressing

58:52

. If you are focusing

58:55

on cash performance, it is better

58:58

to choose open addressing.

59:02

Okay, after we see how

59:04

hashing is done and the

59:05

benefits of hashing, eh, the performance

59:09

of the hand sori of this hashing is of

59:11

course, eh, what is it called, it is better if

59:15

we don't use hashing, yes, for

59:18

cases that, what are they called, yes,

59:22

when we apply, eh, the hashing process

59:25

or implement

59:28

hashing, ee, the average case is

59:31

close to O1,

59:34

yes, meaning it is better than if

59:36

we don't apply hashing,

59:40

eh, the time complexity is O N, yes,

59:44

for each insert, eh, search, and

59:47

delation. So, whatever we want to use,

59:53

whatever the hashing technique,

59:56

as long as we use hashing, it is

59:57

expected to be able to

1:00:00

make the performance of the insertion of the

1:00:03

search deletions in

1:00:07

our operation better,

1:00:09

increase the time or speed up

1:00:12

our time complexity.

1:00:14

Well,

1:00:16

earlier we saw two kinds of techniques,

1:00:19

eh eh hashing eh oh sorry, two kinds of

1:00:24

techniques to overcome chain

1:00:29

chain collusion and eh open addressing. We

1:00:32

also see how eh

1:00:35

chaining methods are done and how

1:00:37

open addressing is done.

1:00:40

Well, this is

1:00:42

just a summary or conclusion of the

1:00:46

operators of the chaining and open

1:00:49

addressing techniques to help you in

1:00:51

choosing

1:00:55

which collusion technique you want to use.

1:00:58

Yes, one way to choose eh

1:01:03

collusion eh technique is to look at the load

1:01:06

factor, yes. If the load factor is

1:01:10

large, it is better to

1:01:15

use chaining. So

1:01:19

ideally when your vector load is

1:01:22

between 1 and 3, it's better to

1:01:25

use the chain directly. Even though the

1:01:30

load factor is true, the load factor is getting higher

1:01:32

. And if the load vector,

1:01:37

the higher the vector load, the

1:01:40

lower the performance.

1:01:44

Performance is getting worse. So, if

1:01:48

we increase load vector 1 to load

1:01:53

vector 3, we hope that load vector 1 will be

1:01:56

faster than when we increase load vector

1:01:59

to 3.

1:02:02

So, for chaining, if our

1:02:05

load factor is more than one, it is

1:02:07

better to use a chain directly.

1:02:12

Because if we use open

1:02:14

addressing, the performance will

1:02:19

drop significantly when

1:02:22

it approaches one. So when the load

1:02:26

factor is below 1, yes, 0.6

1:02:32

or 0.7, below one, immediately

1:02:35

use opened racing. Ideally, the low

1:02:38

detector is 0.6 to 0.75. Well,

1:02:42

that's ideal for using

1:02:44

tracing, right?

1:02:49

And again, performance decreases

1:02:50

if the load is high. So, if the

1:02:54

load factor is less than one, it is

1:02:58

better to use the

1:02:59

ideal addressing of 0.6 to 0.7. That's

1:03:01

why in the previous slide

1:03:04

you saw that there are several constraints

1:03:10

that must be met when we

1:03:13

use open addressing. Okay,

1:03:18

so one of the concerns is

1:03:20

that this load vector must be less

1:03:24

than

1:03:25

one

1:03:27

. You can still use it, eh,

1:03:30

if your load factor is less

1:03:32

than one, you can use

1:03:34

chaining. Changing is fine, but it's

1:03:38

not optimal.

1:03:40

There is a more optimal option when the load

1:03:41

vor factor is less than one, namely open

1:03:43

addressing, right? Please feel free to

1:03:46

use any collusion technique you like

1:03:50

, but again, choose the

1:03:53

most appropriate one or the one that is

1:03:55

most profitable.

1:03:57

with your condition, yes.

1:04:02

Well, for the implementation

1:04:08

of hashing, it is widely used

1:04:10

for databases,

1:04:13

for database management, then

1:04:16

cash management, and password storage. Because it can be

1:04:19

said that hashing is also like an

1:04:23

encryption process. So for ee

1:04:26

password it is also quite ee good.

1:04:33

Okay. Well, the

1:04:35

factors

1:04:37

that make eh hashing eh can be

1:04:41

said to be good hashing

1:04:43

are that we have seen

1:04:46

uniformity earlier, right? If the key is distributed

1:04:48

uniformly, it is called

1:04:51

uniform

1:04:53

key

1:05:01

distribution. Well, that's sudden,

1:05:04

uh, what's it called? Our hashing is

1:05:07

good. Then efficiency. If it

1:05:10

increases our efficiency, from

1:05:14

our searches or our data retrieval,

1:05:18

it indicates that our hashing is

1:05:21

useful or good for us to implement. Yes,

1:05:31

the irreversibility issue is

1:05:38

related to the

1:05:41

actual password of this encryption. If for example

1:05:44

we can have several ee factors,

1:05:50

there are some things that we should

1:05:52

not be able to

1:05:54

restore the value or it is very difficult to

1:05:57

restore the original value for

1:06:00

protection problems such as this password.

1:06:03

So, for example, if we have

1:06:04

entered the functions of

1:06:09

this hash, the input hash function

1:06:13

, we enter the function, there must be a

1:06:15

mechanism, there must be a mechanism that is

1:06:19

sufficient, what is sufficient? It's safe enough or secure enough

1:06:23

so that we can see the original input.

1:06:25

Well, this is usually used by

1:06:27

passwords or ee encryption processes,

1:06:30

yes.

1:06:32

So it is not easy to restore the

1:06:35

original value to protect the

1:06:38

existing data.

1:06:42

Well, er, determinism means that

1:06:46

if the input is the same,

1:06:49

if the input is the same, it must

1:06:52

produce the same output too.

1:06:56

So

1:06:59

yes, if the input is the same, the output must

1:07:01

also be the same.

1:07:06

This is another word for consistency,

1:07:11

yes. So there should be no

1:07:13

randomization process that could cause the

1:07:16

input and output to be

1:07:20

different. That means later you won't be

1:07:23

able to, ee, what's it called? What we query

1:07:28

may not be able to retrieve ee

1:07:31

what is the name ee original data.

1:07:35

Right? Well, that is the material that we

1:07:39

can discuss regarding this ee hasing.

More transcripts

Explore other videos transcribed with YouTLDR.

Get the TLDR of any YouTube video

Transcribe, summarize, and repurpose videos in 125+ languages — free, no signup required.

Try YouTLDR Free