ProgrammingModerate
A complete binary tree has levels 0 to 2 (depth 3 in this count). How many nodes does it have?
- A. 7
- B. 6
- C. 8
- D. 15
Correct answer: A. 7
Each full level doubles the count: 1 + 2 + 4 = 7 nodes in total.
More C Programming questions
- A chained hash bucket holds the nodes 30, 20, 10 in that order from the head. The node holding 20 is deleted and freed. How many nodes…
- A program makes three malloc calls and two free calls, with no other allocations. How many blocks are still allocated when the program…
- int a = calloc(4, sizeof a); int sum = 0; for (int i = 0; i < 4; i++) sum += a[i]; printf("%d", sum); What is printed?
- Which statement about calling free on a null pointer is correct in C?
- A pointer p is freed with free(p) and then set to NULL. Why is this safer than leaving it dangling?
- Which code creates a flexible structure holding n ints after a header, with a single allocation and correct size?