Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
cours
Commits
a475111d
Verified
Commit
a475111d
authored
3 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
updated the slides
parent
329d6f52
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#15190
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/cours_14.md
+64
-0
64 additions, 0 deletions
slides/cours_14.md
with
64 additions
and
0 deletions
slides/cours_14.md
+
64
−
0
View file @
a475111d
...
...
@@ -107,3 +107,67 @@ bool search(table, key, value) {
}
```
# Écrivons le code!
*
Mais avant:
*
Quelles sont les structures de données dont nous avons besoin?
*
Y a-t-il des fonctions auxiliaires à écrire?
*
Écrire les signatures des fonctions.
. . .
## Structures de données
. . .
```
C
typedef enum {empty, deleted, occupied};
typedef ... key_t;
typedef ... value_t;
typedef struct _cell_t {
key_t key;
value_t value;
state_t state;
} cell_t;
typedef struct _hm {
cell_t *table;
int capacity;
int size;
} hm;
```
# Écrivons le code!
## Fonctions auxiliaires
. . .
```
C
static int hash(key_t key);
static int rehash(int index, key_t key);
static int find_index(hm h, key_t key);
```
## Signature de l'API
```
C
void hm_init(hm *h, int capacity);
void hm_destroy(hm *h);
bool hm_set(hm *h, key_t key, value_t *value);
bool hm_get(hm h, key_t key, value_t *value);
bool hm_remove(hm *h, key_t key, value_t *value);
bool hm_search(hm h, key_t key);
void hm_print(hm h);
```
# Live code session!
0.
Offered to you by ProtonVPN!
. . .
1.
Like the video.
2.
Subscribe to the channel.
3.
Use our one time voucher for ProtonVPN:
`PAULISAWESOME`
.
4.
Consider donating on our patreon.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment