Skip to content

Implementation of Priority Queue#2

Merged
minnce merged 14 commits intomainfrom
Tree
Apr 13, 2025
Merged

Implementation of Priority Queue#2
minnce merged 14 commits intomainfrom
Tree

Conversation

@minnce
Copy link
Owner

@minnce minnce commented Apr 11, 2025

No description provided.

@minnce minnce requested a review from lc10934 April 11, 2025 23:43
{
size_t left = currInd * 2 + 1;
size_t right = currInd * 2 + 2;
T newLargest = currInd;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newLargest is an index so should be type size_t

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@minnce minnce closed this Apr 12, 2025
@minnce minnce reopened this Apr 12, 2025
}

const T &pop_front()
T pop_front()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct change

size_t size() const { return sz; }

private:
void refactor(size_t currInd)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if refactor is a great name for this but up to you

maxSz = newSize;
}

std::unique_ptr<T[]> tree;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simiar thing here, id probably use a std::array instead fo a C style array

private:
void refactor(size_t currInd)
{
size_t left = currInd * 2 + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing some const

@minnce minnce merged commit 95e640a into main Apr 13, 2025
3 checks passed
@minnce minnce deleted the Tree branch April 13, 2025 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants