From 37ca8ca5bf9269a60a51e5e55c7429b87b59b502 Mon Sep 17 00:00:00 2001 From: eason <30045503+Eason0729@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:00:25 +0800 Subject: [PATCH] format --- a.txt | 67 ++++++++++++++++++++++++++-------------------------- homework_11 | Bin 39240 -> 39352 bytes src/v1.c | 9 +++++-- src/v3.c | 8 ++++--- 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/a.txt b/a.txt index 78edceb..67e84d8 100644 --- a/a.txt +++ b/a.txt @@ -31,39 +31,40 @@ make[2]: Leaving directory '/home/eason/Documents/project/HW11' [100%] Built target homework_11 make[1]: Leaving directory '/home/eason/Documents/project/HW11' /usr/bin/cmake -E cmake_progress_start /home/eason/Documents/project/HW11/CMakeFiles 0 -the number of prefixes with prefix length 0 = 0 -the number of prefixes with prefix length 1 = 0 -the number of prefixes with prefix length 2 = 0 -the number of prefixes with prefix length 3 = 1 -the number of prefixes with prefix length 4 = 0 -the number of prefixes with prefix length 5 = 1 -the number of prefixes with prefix length 6 = 3 -the number of prefixes with prefix length 7 = 4 -the number of prefixes with prefix length 8 = 107 -the number of prefixes with prefix length 9 = 3 -the number of prefixes with prefix length 10 = 5 -the number of prefixes with prefix length 11 = 9 -the number of prefixes with prefix length 12 = 47 -the number of prefixes with prefix length 13 = 70 -the number of prefixes with prefix length 14 = 164 -the number of prefixes with prefix length 15 = 317 -the number of prefixes with prefix length 16 = 6117 -the number of prefixes with prefix length 17 = 1083 -the number of prefixes with prefix length 18 = 1769 -the number of prefixes with prefix length 19 = 4489 -the number of prefixes with prefix length 20 = 5553 -the number of prefixes with prefix length 21 = 4246 -the number of prefixes with prefix length 22 = 6090 -the number of prefixes with prefix length 23 = 7772 -the number of prefixes with prefix length 24 = 43679 -the number of prefixes with prefix length 25 = 383 -the number of prefixes with prefix length 26 = 387 -the number of prefixes with prefix length 27 = 439 -the number of prefixes with prefix length 28 = 338 -the number of prefixes with prefix length 29 = 989 -the number of prefixes with prefix length 30 = 454 -the number of prefixes with prefix length 31 = 1 -the number of prefixes with prefix length 32 = 113 +The total number of prefixes in the input file is : 84633. +the number of prefixes with prefix length 0 = 0. +the number of prefixes with prefix length 1 = 0. +the number of prefixes with prefix length 2 = 0. +the number of prefixes with prefix length 3 = 1. +the number of prefixes with prefix length 4 = 0. +the number of prefixes with prefix length 5 = 1. +the number of prefixes with prefix length 6 = 3. +the number of prefixes with prefix length 7 = 4. +the number of prefixes with prefix length 8 = 107. +the number of prefixes with prefix length 9 = 3. +the number of prefixes with prefix length 10 = 5. +the number of prefixes with prefix length 11 = 9. +the number of prefixes with prefix length 12 = 47. +the number of prefixes with prefix length 13 = 70. +the number of prefixes with prefix length 14 = 164. +the number of prefixes with prefix length 15 = 317. +the number of prefixes with prefix length 16 = 6117. +the number of prefixes with prefix length 17 = 1083. +the number of prefixes with prefix length 18 = 1769. +the number of prefixes with prefix length 19 = 4489. +the number of prefixes with prefix length 20 = 5553. +the number of prefixes with prefix length 21 = 4246. +the number of prefixes with prefix length 22 = 6090. +the number of prefixes with prefix length 23 = 7772. +the number of prefixes with prefix length 24 = 43679. +the number of prefixes with prefix length 25 = 383. +the number of prefixes with prefix length 26 = 387. +the number of prefixes with prefix length 27 = 439. +the number of prefixes with prefix length 28 = 338. +the number of prefixes with prefix length 29 = 989. +the number of prefixes with prefix length 30 = 454. +the number of prefixes with prefix length 31 = 1. +the number of prefixes with prefix length 32 = 113. | 00000000 | | 00000001 | ---> | 1.0.0.0 | | 00000010 | ---> | 2.0.0.0 | diff --git a/homework_11 b/homework_11 index a5edad5ea4b75f5183a2cca7c7d15597358e0826..74c799aa25161770d7d47a7891ab3dee7870f0f3 100755 GIT binary patch delta 6467 zcmaJ`3s96-mi{08H{Epi|92~>AVPyY6%`Z}AJJAJG=>qJ0mMWF<0FzX23LsBo@T^X z2aS;HMzUolm`Ns@a&}os&639o*)c2Dx*3wVJMQi{qEXXqj4`f8tw~MqckbUm4awG0 z)%QH_x#ygF@44sK-qTW7r__=ucC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jDNsGZAR=1K;o%$@HrG!dkNyd!HS}>gfD5IS9jJ9M z`65u!)NNww$KV^MIJ8#)DHc-5%@hh8nrnBpOddqnqF@NXj0jvQJ?cQ;j0d4)aIZeWVQ#}G-`8Pgs*AWsLc^h ztUapL0;hc2)^%vq=1_)h>$@~+bA)r=9*x?Zq=OscT|H1dmfD(FO1%3j&)kri@i`Xn zqISkM#ZAYY+L@>$u`w_4F-x0dolPp%wmehnll@zJLhr_H`gQEm70r?*e#h1+tS zKPXY87&)d!VfJ|L+qTZ3+a6IWY}=Hj{NlDBNe4QgsGDrTx5|%y@Nbg0(^nsBk!RTM z zUh?tp?t307`0Kv)4k?STI+Pb}dT=|3A3U^3s^q^vl;?>2head=xor_insert_mid(NULL,state->head,mask); } + printf("The total number of prefixes in the input file is : %zu.\n",amount); + } void length_distribution(struct State* state){ @@ -37,5 +42,5 @@ void length_distribution(struct State* state){ } for(usize i=0;i<=32;i++) - printf("the number of prefixes with prefix length %zu = %zu\n",i,lens[i]); + printf("the number of prefixes with prefix length %zu = %zu.\n",i,lens[i]); } \ No newline at end of file diff --git a/src/v3.c b/src/v3.c index cb78060..5ed492e 100644 --- a/src/v3.c +++ b/src/v3.c @@ -58,7 +58,7 @@ void prefix_insert(struct State* state){ parse_submask(buffer,mask); struct SizedSubmask* ip=clone_submask(mask); - // record_start + record_start if(reduce_submask(mask)){ struct Node* ll=hash_pop(state->hashmap,mask); @@ -67,7 +67,7 @@ void prefix_insert(struct State* state){ hash_insert(state->hashmap,mask,new); }else state->head=xor_insert_mid(NULL,state->head,ip); - // record_end("prefix_insert.csv") + record_end("prefix_insert.csv") freq++; } @@ -93,6 +93,9 @@ void prefix_delete(struct State* state){ if(reduce_submask(mask)){ struct Node* ll=hash_pop(state->hashmap,mask); + if(ll==NULL){ + log_warn("not found"); + } struct Node* new_head=xor_remove_match(ll,ip,eq_v3); if(new_head!=NULL)hash_insert(state->hashmap,mask,new_head); @@ -105,7 +108,6 @@ void prefix_delete(struct State* state){ record_end("prefix_delete.csv") - free(ip); }