Skip to content

Conversation

Kroppeb
Copy link

@Kroppeb Kroppeb commented Dec 23, 2019

No description provided.

@Gathros
Copy link
Contributor

Gathros commented Dec 25, 2019

This code doesn't work for a string of one unique character multiple times. I don't know Kotlin at all but I have a fix you can look at and improve on.

if (priorityQueue.size == 1) {
    val left = priorityQueue.remove()
    val right = Leaf(0, '\u0000')
    root = Branch(left, right)
} else {
    root = priorityQueue.remove() as? Branch ?: error("No support for string of one unique letter")
}

I'm not sure how to get right to be a null object but this will do.

Signed-off-by: Robbe Pincket <[email protected]>
@berquist
Copy link
Member

I just saw this. Why are these changes on top of #640?

@berquist berquist added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label May 24, 2020
@ntindle
Copy link
Member

ntindle commented Aug 28, 2021

[lang: kotlin]

@github-actions github-actions bot added the lang: kotlin Kotlin programming language label Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: kotlin Kotlin programming language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants