小编Tek*_*ept的帖子

What are the step to the Reingold-Tilford algorithm and how might I program it?

From the presentation: Graphs and Trees on page 3, there is a visual presentation of what takes place during the Reigngold-Tilford process; it also gives a vague summary to this algorithm before hand: "...starts with bottom-up pass of the tree; [finishes with] Top-down pass for assignment of final positions..." I can achieve both directional passes through recursive means, and I know that the Y-value(s) are respective to each node's generation level, but I'm still lost as to how the X-coordinates …

c# algorithm tree user-interface winforms

5
推荐指数
1
解决办法
5583
查看次数

需要4 GB或5 GB数字的算法 - 是否可能?

好的,这个问题确实是一个挑战!

背景

我正在研究一个涉及大于正常数字的基于算术的项目.我是新的,我将使用4 GB封装文件大小的最坏情况 - (我正在跳跃甚至将其扩展到5GB上限,因为我之前看到的文件大小超过4 GB - 特别是图像*. iso文件)

一般问题

现在,我将应用计算的算法此刻无关紧要,但是加载和处理如此大量的数据 - 数字 - 这样做.

  • A System.IO.File.ReadAllBytes(String)只能读取2 GB的文件数据上限,所以这是我的第一个问题 - 如何加载和/或配置访问内存,这样的文件大小 - 两倍,如果不是更多?
  • 接下来,我正在编写自己的类来将'stream'或字节数组视为一个大数字,并添加多个运算符方法来执行十六进制算法,直到我System.Numerics.BigInteger()在线阅读该类 - 但是因为没有BigInteger.MaxValue,我只能一次加载最多2 GB的数据,我不知道它的潜力是什么BigInteger- 甚至与我写的对象Number()(具有我想要的最小潜力)相比.可用内存和性能也存在问题,但我并不关心速度,而是成功地完成了这个实验过程.

摘要

  • 我该如何加载4-5千兆字节的数据?
  • 加载后如何存储和处理数据?坚持BigInteger或完成我自己的Number课程?
  • 如何在运行时处理如此大量的内存而不会耗尽内存?我将像任何其他数字一样处理4-5 GB的数据而不是字节数组 - 执行除法和乘法等算法.

PS根据非披露协议,我无法透露有关该项目的太多信息.;)

对于那些希望从我的Number对象中看到每个字节数组加法器(C#)的示例运算符的人:

public static Number operator +(Number n1, Number n2)
{
    // GB5_ARRAY is a cap constant for 5 GB - 5368709120L
    byte[] data = new byte[GB5_ARRAY];
    byte rem = 0x00, bA, …
Run Code Online (Sandbox Code Playgroud)

c# memory biginteger

4
推荐指数
1
解决办法
353
查看次数

标签 统计

c# ×2

algorithm ×1

biginteger ×1

memory ×1

tree ×1

user-interface ×1

winforms ×1