contributed by < huang-me
>
注意作業書寫規範!
Download cppcheck source code from GitHub.
Your gcc was too old. Upgrade your Linux distribution as soon as possible, otherwise you will encounter some unexpected issues later.
malloc
to acquire memory space, return NULL if no space available.INTI_LIST_HEAD
defined in list.h
list_for_each_entry_safe
defined in list.h
to iterate through all nodes in list, remove them from list and release the memory.malloc
allocate memory, return false
if no memory can be allocated.memset
initialize the value of newNode
and copy input to newNode->value
q_insert_head
, the only difference is replace list_add
with list_add_tail
.list_entry
to get the address of the entry.q_remove_head
, the only difference is the node position is changed from head->next
to head->prev
.e->value
and e
if they were defined.list_for_each
and count the number of elements.fast/slow
pointer find middle element of linked list and delete it.strdup
may lead to memory leak since the space is never released.
Rewrite q_delete_dup
as following code to prevent copying data.
Shorten code with use of list.h functions.
next
and prev
pointer to achieve reverse.O(nlogn)
Shorten merge code with use of list.h function.
Insert/Remove time complexity test doesn't always pass in GitHub CI.
You should read the paper and recognize the root cause.
jservImage Not Showing Possible ReasonsLearn More →
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
q_shuffle
into queue.c
q_size
timesq_shuffle
definition into queue.h header file.do_shuffle
in qtest.c
.