From 51e4236416e08a4f54f21119beb80fe0fe2a045e Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Fri, 17 Nov 2023 13:45:13 -0500 Subject: [PATCH] line breaks --- lectures/23_priority_queues_II/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lectures/23_priority_queues_II/README.md b/lectures/23_priority_queues_II/README.md index 9b5cbce..35bdb3e 100644 --- a/lectures/23_priority_queues_II/README.md +++ b/lectures/23_priority_queues_II/README.md @@ -77,9 +77,13 @@ and the child and parent “pointers” can be implicitly calculated. - To do this, number the nodes in the tree starting with 0 first by level (top to bottom) and then scanning across each row (left to right). These are the vector indices. Place the values in a vector in this order. - As a result, for each subscript, i, + – The parent, if it exists, is at location ⌊(i − 1)/2⌋. + – The left child, if it exists, is at location 2i + 1. + – The right child, if it exists, is at location 2i + 2. + - For a binary heap containing n values, the last leaf is at location n − 1 in the vector and the first node with less than two children is at location ⌊(n − 1)/2⌋. - The standard library (STL) priority_queue is implemented as a binary heap.