Search Results

Search found 70567 results on 2823 pages for 'binary file'.

Page 9/2823 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Algorithm to Render a Horizontal Binary-ish Tree in Text/ASCII form

    - by Justin L.
    It's a pretty normal binary tree, except for the fact that one of the nodes may be empty. I'd like to find a way to output it in a horizontal way (that is, the root node is on the left and expands to the right). I've had some experience expanding trees vertically (root node at the top, expanding downwards), but I'm not sure where to start, in this case. Preferably, it would follow these couple of rules: If a node has only one child, it can be skipped as redundant (an "end node", with no children, is always displayed) All nodes of the same depth must be aligned vertically; all nodes must be to the right of all less-deep nodes and to the left of all deeper nodes. Nodes have a string representation which includes their depth. Each "end node" has its own unique line; that is, the number of lines is the number of end nodes in the tree, and when an end node is on a line, there may be nothing else on that line after that end node. As a consequence of the last rule, the root node should be in either the top left or the bottom left corner; top left is preferred. For example, this is a valid tree, with six end nodes (node is represented by a name, and its depth): [a0]------------[b3]------[c5]------[d8] \ \ \----------[e9] \ \----[f5] \--[g1]--------[h4]------[i6] \ \--------------------[j10] \-[k3] Which represents the horizontal, explicit binary tree: 0 a / \ 1 g * / \ \ 2 * * * / \ \ 3 k * b / / \ 4 h * * / \ \ \ 5 * * f c / \ / \ 6 * i * * / / \ 7 * * * / / \ 8 * * d / / 9 * e / 10 j (branches folded for compactness; * representing redundant, one-child nodes; note that *'s are actual nodes, storing one child each, just with names omitted here for presentation sake) (also, to clarify, I'd like to generate the first, horizontal tree; not this vertical tree) I say language-agnostic because I'm just looking for an algorithm; I say ruby because I'm eventually going to have to implement it in ruby anyway. Assume that each Node data structure stores only its id, a left node, and a right node. A master Tree class keeps tracks of all nodes and has adequate algorithms to find: A node's nth ancestor A node's nth descendant The generation of a node The lowest common ancestor of two given nodes Anyone have any ideas of where I could start? Should I go for the recursive approach? Iterative?

    Read the article

  • Binary to Date (C#) 64 Bit Format

    - by Veskechky
    We have a binary file from which we have identified the following dates (as Int64). We now the following facts about the Date/Time format; The 64 bit Date has a resolution to the microsecond The 64 bit Date has a range of 4095 years The Int64 9053167636875050944 (0x7DA34FFFFFFFFFC0) = 9th March 2010 The Int64 9053176432968073152 (0x7DA357FFFFFFFFC0) = 10th March 2010 The Int64 9053185229061095360 (0x7DA35FFFFFFFFFC0) = 11th March 2010 The Int64 9053194025154117568 (0x7DA367FFFFFFFFC0) = 12th March 2010 Any help on figuring out a way to convert this to a valid C# Date/Time is appreciated.

    Read the article

  • Convert 64bit Binary to Long equivalent

    - by washtik
    How can we convert the following 64 bit binary into the long equivalent; 01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000 equals 7D A3 4F FF FF FF FF C0 HEX equals 9053167636875050944 << this is the value we want in a C# variable

    Read the article

  • C++ exceptions binary compatibility

    - by aaa
    hi. my project uses 2 different C++ compilers, g++ and nvcc (cuda compiler). I have noticed exception thrown from nvcc object files are not caught in g++ object files. are C++ exceptions supposed to be binary compatible in the same machine? what can cause such behavior?

    Read the article

  • Maintaing list order in binary tree.

    - by TheBigO
    Given a sequence of numbers, I want to insert the numbers into a balanced binary tree such that when I do a preorder traversal on the tree, it gives me the sequence back. How can I construct the insert method corresponding to this requirement? Remember that the tree must be balanced, so there isn't a completely trivial solution. I was trying to do this with a modified version of an AVL tree, but I'm not sure if this can work out.

    Read the article

  • Balancing a Binary Tree (AVL)

    - by Gustavo Carreno
    Ok, this is another one in the theory realm for the CS guys around. In the 90's I did fairly well in implementing BST's. The only thing I could bever get my head around was the intricacy of the algorithm to balance a Binary Tree (AVL). Can you guys help me on this?

    Read the article

  • Code golf - hex to (raw) binary conversion

    - by Alnitak
    In response to this question asking about hex to (raw) binary conversion, a comment suggested that it could be solved in "5-10 lines of C, or any other language." I'm sure that for (some) scripting languages that could be achieved, and would like to see how. Can we prove that comment true, for C, too? NB: this doesn't mean hex to ASCII binary - specifically the output should be a raw octet stream corresponding to the input ASCII hex. Also, the input parser should skip/ignore white space. edit (by Brian Campbell) May I propose the following rules, for consistency? Feel free to edit or delete these if you don't think these are helpful, but I think that since there has been some discussion of how certain cases should work, some clarification would be helpful. The program must read from stdin and write to stdout (we could also allow reading from and writing to files passed in on the command line, but I can't imagine that would be shorter in any language than stdin and stdout) The program must use only packages included with your base, standard language distribution. In the case of C/C++, this means their respective standard libraries, and not POSIX. The program must compile or run without any special options passed to the compiler or interpreter (so, 'gcc myprog.c' or 'python myprog.py' or 'ruby myprog.rb' are OK, while 'ruby -rscanf myprog.rb' is not allowed; requiring/importing modules counts against your character count). The program should read integer bytes represented by pairs of adjacent hexadecimal digits (upper, lower, or mixed case), optionally separated by whitespace, and write the corresponding bytes to output. Each pair of hexadecimal digits is written with most significant nibble first. The behavior of the program on invalid input (characters besides [a-fA-F \t\r\n], spaces separating the two characters in an individual byte, an odd number of hex digits in the input) is undefined; any behavior (other than actively damaging the user's computer or something) on bad input is acceptable (throwing an error, stopping output, ignoring bad characters, treating a single character as the value of one byte, are all OK) The program may write no additional bytes to output. Code is scored by fewest total bytes in the source file. (Or, if we wanted to be more true to the original challenge, the score would be based on lowest number of lines of code; I would impose an 80 character limit per line in that case, since otherwise you'd get a bunch of ties for 1 line).

    Read the article

  • Re-adjusting a binary heap after removing the minimum element

    - by BeeBand
    After removing the minimum element in a binary heap, i.e. after removing the root, why is the last leaf then assigned to the root and sifted down? Why not take the lesser child of what used to be the root and just keep sifting up all the children? Isn't this the same amount of operations, so why is the "sift down" method preferred?

    Read the article

  • How to create Binary Tree in a image(.jpeg)

    - by abc
    I have data structured in Binary tree format, i want to represent it into an image(*. jpeg) then i need to display that image on web page and all the data will come @ runtime, so image processing should be done @ runtime, how to do this ? This is what my thought solution any other suitable solution are also welcomed, web site is in .NET , i am thinking to produce image using java api then integrate it to .NET wither through WEB-SERVICE call or any other solutions are also welcomed.

    Read the article

  • How does the binary DAT from Maxmind work?

    - by Rich
    Maxmind offers a binary DAT file format for downloading their GeoIP database. http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz Does anyone know how this has been packaged? Also, is there any kind of copy protection on the data? I'd like to offer up a set of data in a similar way. Anyone with any knowledge of this will receive my undying gratitude :-)

    Read the article

  • how do I base encode a binary file (JPG) in ruby

    - by Angela
    I have a binary files which needs to be sent as a string to a third-party web-service. Turns out it requires that it needs to be base64 encoded. In ruby I use the following: body = body << IO.read("#{@postalcard.postalimage.path}") body is a strong which conists of a bunch of strings as parameters. So...how do I base64 encode it into this string? Thanks.

    Read the article

  • binary number in c++

    - by baash05
    In c++ 0x10 is the way to represent a hex value. if I leave off the 0x then it's dec. Is there a way to define a binary? Not that I can't derive 0x0003 is 11, but it would be cool if I could use 0b0011. It would just make the code a little more obvious.

    Read the article

  • Need help with Binary Columns

    - by nusrath
    Hi, I have to query a column containing a Binary column with data like this ®â{Õ¦K!Eòû¦?;#§ø. How can i query this colmn..if I wanted something like: SELECT Name FROM Users WHERE ID = ®â{Õ¦K!Eòû¦?;#§ø THanks

    Read the article

  • Convert a post-order binary tree traversal index to an level-order (breadth-first) index

    - by strfry
    Assuming a complete binary tree, each node can be adressed with the position it appears in a given tree traversal algorithm. For example, the node indices of a simple complete tree with height 3 would look like this: breadth first (aka level-order): 0 / \ 1 2 / \ / \ 3 4 5 6 post-order dept first: 6 / \ 2 5 / \ / \ 0 1 3 4 The height of the tree and an index in the post-order traversal is given. How can i calculate the breadth first index from this information?

    Read the article

  • Wix CustomAction Binary SourceFile not found

    - by narenvarmap
    <Binary Id="binUpdate" SourceFile="c:\xxx\Update.exe"/> <CustomAction Id="Update" BinaryKey="binUpdate" Execute="deferred" ExeCommand="c:\xxx" /> When I build a Wix project with the above custom action, it complains that "The system cannot find the file 'C:\xxx\Update.exe". This update.exe is deployed by the same msi. So, how do I make Wix to ignore the fact that the file does not exist on my build machine? Thanks in advance

    Read the article

  • Building a balanced binary search tree

    - by Znarkus
    Hi! Is there a method to build a balanced binary search tree? Example: 1 2 3 4 5 6 7 8 9 5 / \ 3 etc / \ 2 4 / 1 I'm thinking there is a method to do this, without using the more complex self-balancing trees. Otherwise I can do it on my own, but someone probably have done this already :)

    Read the article

  • binary operator "<"

    - by md004
    Consider this expression as a "selection" control structure on integer "x": 0 < x < 10, with the intention that the structure returns TRUE if "x" is in the range 1..9. Explain why a compiler should not accept this expression. (In particular, what are the issues regarding the binary operator "<"? Explain how a prefix operator could be introduced so the expression can be successfully processed.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >