From ba9cb61ac8a9dcf6c736aeb53dd41a88c304e140 Mon Sep 17 00:00:00 2001 From: Vladimir Kotal Date: Mon, 29 Apr 2024 07:02:48 +0000 Subject: [PATCH] Refresh HTML pages --- 10.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/10.html b/10.html index 3a7880c9..15bf11f3 100644 --- a/10.html +++ b/10.html @@ -10081,6 +10081,7 @@

+

👀 use-after-free.c

Memory leaks

If memory allocated on the heap is not freed, it creates a resource leak called a memory leak as the allocator deems such memory used even that your code no @@ -10166,10 +10167,11 @@

Write a program that creates a binary tree with N + 1 nodes, where N is specified as a command line argument.

Each node, besides the root (that is always created), will contain an -integer and will be created like this: take a binary representation of the +integer member and will be created like this: take a binary representation of the number in the sequence {0, 1, ..., N - 1} and traverse the pre-existing tree using this representation until a NULL node pointer is found. 0 means the left child, 1 means the right one.

+

Only the leaf nodes actually contain the number.

For example, for 5 (101 in binary), the tree will be created as follows:

  1. create root node
  2. @@ -10180,7 +10182,7 @@

    Once the tree is populated, traverse the tree (choose your method), count the nodes and print the number to the standard output.

    Variant: add a function pointer to each node that will be called on its visit. -The number stored in the node will be the sole argument of this function.i Use +The number stored in the node will be the sole argument of this function. Use that to traverse the tree and free the memory in the process.

    🔧 Home assignment

    Note that home assignments are entirely voluntary but writing code is the only