yosshi4486 / SternBrocotTreeSwift

MIT License
0 stars 0 forks source link

Make stern brocot tree sequence by level. #58

Closed yosshi4486 closed 3 years ago

yosshi4486 commented 3 years ago

if I give '10' to a function, it returns the sequence owns 1024 proper nodes of stern brocot tree aligned left to right.

yosshi4486 commented 3 years ago

Because sbtree is binary tree.

yosshi4486 commented 3 years ago

or 'makeSternBrocotTree(numberOfNodes: Int)' determines the actual level and returns least node.

yosshi4486 commented 3 years ago

and makeNodesSequenceOfSpefifiedLevel(_ level: Int)

yosshi4486 commented 3 years ago
class SternBrocotTree {

    private(set) var nodes: [SBTreeNode]

    init(heightOfTree: Int) { }

    init(level: Int) { }

   func nodes(at level: Int) -> [SBTreeNode]? { }
}