Storing B-tree on the Disk

This is a discussion on Storing B-tree on the Disk within the C Programming forums, part of the General Programming Boards category; Hey everybody I am working on a program where I have created a binary tree with node as described below:- ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    1

    Question Storing B-tree on the Disk

    Hey everybody I am working on a program where I have created a binary tree with node as described below:-

    Code:
    struct node {
        uint32_t data;   
        uint32_t bitstring; 
    	 uint32_t level;
        struct node* left;
        struct node* right;
    };
    So I want to create the tree and fill with data once and then want to store on the Disk so that I can use this saved tree Again and Again whenever I need ....Any suggestions How this can be done in C or C++.

    Thanks

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Write the list out in order of traversal, then link again as you load. Either save node numbers instead of pointers, or just save a 0 or 1 for each child, left and right.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,269
    Oh how disappointing, it's not a B-Tree at all, it's just a binary tree.

    So did you miss-name it or did you implement the wrong thing?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >So did you miss-name it or did you implement the wrong thing?


    I wasn't going to say anything, but that's actually a good question. If your assignment was to implement a B-Tree you've implemented the wrong thing. B-Tree != Binary tree

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  2. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 08:09 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21