A binary tree is given with sequential storage ,write a algorithm n program to copy the binary tree into linked list..question is all about 2 convert binary tree to linked list
209675
I think you're trying to do it the hard way...how about simply traversing the binary tree sequentially and adding each node to the linked list.  \n\nThe binary tree will not readily have a sequential read capability so you need to know the range and smallest increment of the elements.  This one, however, is stated to have "Sequential storage."\n\nThe linked-list will already have an insert-into-list method or it couldn't be a linked list from a working list class.\n\n\nyour algorhithm will have a loop starting with an enf of file check against the binary read and use the insert method of the linked-list until EOF...that's all.  A single loop with a binary read, a write and a check for EOF::\n\npseudocode:\nbinary::readfirst\ndo until eof\n  link::insert\n  binary::readnext\nend do\n\nwasn't that simple?
503448
Your language is most likely c/c++, so the answer is then yes. You will then have 50 strings ranging from list[0] to list[49] in which to store your data. Of course, you will have to include the correct header file, i.e. #include <filename>, and if in c++, make sure to include "using namespace std;" (if appropriate in your program).\n\nWhy not just try it and see what the compiler tells you? One of the best ways to learn programming is to just try things and see what happens. If the result is not what you expected, try something else!
103745
IN computer language ,everything need to be converted into machine level language. THen it is executed by the processor.\nIn your program also, 1st preprocessor directive include<stdio.h> defines the standard function like printf.\nmain is SPECIAL function  and print is standard input statement.\nCompile covert your source into machine level language. while linker link the files with macros,preprocessor directives. Run command execute the program..//this is abt windows.\nIN unix\ninstead of turboc, there is CC compiler. which compiles the code. while to run the program just type ./a.out\n\nso steps to doin uNIX are:\n\n1. vi filename.c\n2.cc fileaname.c\n3./a.out\n\n\nHi! what type of more detail u want? about execution in unix or programming in unix?or anything else..?
661474
#ifndef BINARY_SEARCH_TREE_H_\n        #define BINARY_SEARCH_TREE_H_\n\n        #include "dsexceptions.h"\n        #include <iostream.h>       // For NULL\n\n          // Binary node and forward declaration because g++ does\n          // not understand nested classes.\n        template <class Comparable>\n        class BinarySearchTree;\n\n        template <class Comparable>\n        class BinaryNode\n        {\n            Comparable element;\n            BinaryNode *left;\n            BinaryNode *right;\n\n            BinaryNode( const Comparable & theElement, BinaryNode *lt, BinaryNode *rt )\n              : element( theElement ), left( lt ), right( rt ) { }\n            friend class BinarySearchTree<Comparable>;\n        };\n\n\n        // BinarySearchTree class\n        //\n        // CONSTRUCTION: with ITEM_NOT_FOUND object used to signal failed finds\n        //\n        // ******************PUBLIC OPERATIONS*********************\n        // void insert( x )       --> Insert x\n        // void remove( x )       --> Remove x\n        // Comparable find( x )   --> Return item that matches x\n        // Comparable findMin( )  --> Return smallest item\n        // Comparable findMax( )  --> Return largest item\n        // boolean isEmpty( )     --> Return true if empty; else false\n        // void makeEmpty( )      --> Remove all items\n        // void printTree( )      --> Print tree in sorted order\n\n        template <class Comparable>\n        class BinarySearchTree\n        {\n          public:\n            explicit BinarySearchTree( const Comparable & notFound );\n            BinarySearchTree( const BinarySearchTree & rhs );\n            ~BinarySearchTree( );\n\n            const Comparable & findMin( ) const;\n            const Comparable & findMax( ) const;\n            const Comparable & find( const Comparable & x ) const;\n            bool isEmpty( ) const;\n            void printTree( ) const;\n\n            void makeEmpty( );\n            void insert( const Comparable & x );\n            void remove( const Comparable & x );\n\n            const BinarySearchTree & operator=( const BinarySearchTree & rhs );\n\n          private:\n            BinaryNode<Comparable> *root;\n            const Comparable ITEM_NOT_FOUND;\n\n            const Comparable & elementAt( BinaryNode<Comparable> *t ) const;\n\n            void insert( const Comparable & x, BinaryNode<Comparable> * & t ) const;\n            void remove( const Comparable & x, BinaryNode<Comparable> * & t ) const;\n            BinaryNode<Comparable> * findMin( BinaryNode<Comparable> *t ) const;\n            BinaryNode<Comparable> * findMax( BinaryNode<Comparable> *t ) const;\n            BinaryNode<Comparable> * find( const Comparable & x, BinaryNode<Comparable> *t ) const;\n            void makeEmpty( BinaryNode<Comparable> * & t ) const;\n            void printTree( BinaryNode<Comparable> *t ) const;\n            BinaryNode<Comparable> * clone( BinaryNode<Comparable> *t ) const;\n        };\n\n        #include "BinarySearchTree.cpp"\n        #endif
652946
Memory Handling.\nWhatever memory space you occupy by instantiating the objects should be released after your use.\nType Casting should also be taken care.
27383
each node is homogeneous with a reference to the next node. instead of storind data in contiguous locations, we can have linked lists to store the same data, by utilizing the free space wherevr it's available in memory. u can have singly, doubly linked lists and circular linked lists. stakcs and queues can also be omplemented thru them.
280232
I'm not sure what you mean by regular induction versus mathematical induction, but I'll take a stab at it.\n\nI learned induction by taking the problem and braking it apart into small pieces, where at least one of the smaller pieces is the same problem, but smaller. Use your hypothesis, and you when you put the pieces back together, you'll end up with your conclusion. So my proof won't involve building up the tree. It will start with the tree and take it apart and then put it back together.\n\n\nBasis: Let T be a full binary tree with one vertex. Let's see what we get.\n\nIt has 0 internal vertices, so k=0. 2*0+1 = 1, and it does indeed have 1 vertex, so that matches.\n\n0 + 1 = 1, and it does indeed have 1 terminal vertex, so the basis is established.\n\nHypothesis: For a full binary tree with j internal vertices, where j < k, then this smaller binary tree has 2j+1 total vertices and j+1 terminal vertices.\n\nInduction: full binary tree T has k internal vertices. Take note that T is made up of its root node, a left hand branch and a right hand branch. Fortunately, both the left and right hand branches are also full binary trees, but how many internal vertices do they each contain.\n\nSince T has a total of k vertices, then we take the root away, and we're left with k-1. We divide each by 2, because we have two sub-trees, and each branch contains (k-1)/2 internal vertices.\n\nNow (k-1)/2 is definitely less than k, so we can use our hypthosis. Let's review:\n\nTV(X) is the total vertices for full binary tree X...\n\nTV(T) = 1 + TV(LBranch) + TV(RBranch)\n\nReplace TV for the branches using the hypothesis...\n\nTV(T) = 1 + (2[(k-1)/2) + 1 + (2[(k-1)/2) + 1\n\nTV(T) = 1 + (k-1) + 1 + (k-1) + 1\n\nTV(T) = 1 + k - 1  + 1 + k - 1 + 1\n\nTV(T) = k + k + 1\n\nTV(T) = 2k + 1\n\nQED\n\nNow for the TermVert. We just need to add the terminal vertices for both of the branches. The root vertex doesn't count, because it's not terminal.\n\nTermVert(T) = TermVert(LBranch) + TermVert(RBranch)\n\nSubstitute the hypothesis to get...\n\nTermVert(T) = (k-1)/2 + 1  +   (k-1)/2 + 1\n\nTermVert(T) = 2[(k-1)/2 + 1]\n\nTermVert(T) = k-1 + 2\n\nTermVert(T) = k+1\n\nQED
372119
You are you using a a pointer and an array while passing a variable to a function called Point. I'm not quite sure what you are trying to point to, but you are copying the heap.
475272
it depends on your programming language! does it do xpath? do you have to parse it? is it in a pre-parsed tree???
429716
a  binary search works on the principle of the left node being smaller than the central node and the right node being larger than the central node..assuming the node i am searching for has the value 5 and the central node 2 levels up is 10\n\nso 10 can have two child nodes right node =14,left node =7\n7 can have two nodes =left node 5,right node 9\n\n\nwhat an index on a record file of variable length would do is assign a unique id to each record in that file,so when the binary search is going on to find a specific node,it will have to follow the lesser path or greater than central node path..so to find the lesser part it will have to determine the position of the next node ..this is done by indexing since all it has to do is to reference that unique id which will point it to the next node and so on...\n\n\nIf the records are not indexed it will not be able to determine which node exists hence will fail
660525
Sequential search:\n\nhttp://cprogramming.com/discussionarticles/sorting_and_searching.html
61012
Let's say you write a program (in either Java or .Net) to retrieve the contents of a single web page.  Then, in your program, you search the page for links to other pages.  Next, recursively, you retrieve those pages and search for links on them.  Etc.  Etc.\n\nYou save all the links in a database with (perhaps) the text content of the page.  You rerun this process nightly and build you "portfolio" of linked pages.\n\nYou might "prime" you database with links from known pages with links to lots of other pages.  Over time, you will have lots of links...
523201
u have to ponit it or use\n\nthese are the 2 way's:\n\n#include <iostream>\nusing namespcae std;\nint main()\n{\nint num[8];\nint index;\n\nnum[0] = 42;\nnum[1] = 2001;\nnum[2] = 7;\nnum[3] = 180;\nnum[4] = 99;\nnum[5] = 1993;\n\nfor(index = 0; index <= 5; index++)\n{\nstd::cout<< index[num] << endl;\n}\n system("pause");\nreturn 0;\n}\n\nor\n\n#include <iostream>\n#define MAX 20\nusing namespcae std;\n\nint main()\n{\n\nint a[MAX] = {23,43,4,5,34,343,12,14};\nint b;\n\ncout.setf(ios::right);\n\nfor(b = 0; b < MAX; b++){\n\ncout << endl << endl;\n\ncout << "The Elemnt in ";\n\ncout.width(2);\n\ncout << (b +1) << " is ";\n\ncout.width(2);\n\nstd::cout << b[a];\n}\nreturn 0;\n}
427987
First take a look on Quick-sort algo-based program :\n\n// Prog: QUICKSORT (RECURSIVE)\n#include<stdio.h>\n#include<conio.h>\n\nvoid quickrec(int *,int,int);      // declaration of function protoype\n\nvoid main()\n{\n  int x[30],n,i;\n  clrscr();\n  printf(" Enter total no. of elements ");\n  scanf("%d",&n);\n  printf(" Enter %d elements ",n);\n  for(i=0;i<n;i++)\n  scanf("%d",&x[i]);\n  quickrec(x,0,n-1);\n  printf(" After sorting get :&#92;n ");\n  for(i=0;i<n;i++)\n  printf(" %d",x[i]);\n  getch();\n}\n\nvoid quickrec(int x[],int lb,int ub)\n{\n  int pivot;\n  if(ub<lb)\n    return;\n  else\n  {\n  pivot=partition(x,lb,ub);\n  quickrec(x,lb,pivot-1);                 // These two\n  quickrec(x,pivot+1,ub);                 // are recursive calls.\n  }\n}\n\nint partition(int x[],int lb,int ub)\n{\n  int a,up,down,temp;\n  up=ub;\n  down=lb;\n  a=x[lb];\n  while(down<up)\n  {\n     while(x[down]<=a && down<ub)\n     down++;\n     while(x[up]>a)\n     up--;\n     if(down<up)\n     {\n       temp=x[down];\n       x[down]=x[up];\n       x[up]=temp;\n     }\n  }\n  temp=x[lb];\n  x[lb]=x[up];\n  x[up]=temp;\n  return up;\n}\n\n- - - - - - - - - - -- - - --- - -- - - -- -- - -- - - -- - - - -- \nNow coming to ur question. Mark '0' as 'down' and '6' as 'up' [bcoz array starts from position '0' & extends to '6', since there're 7 elements]. Again, a=10. Since, x[down]<=a condition is satisfied, down++ occurs. Now, 'down' points to 19. As 7<10, so x[up]>a condition is not satisfied, so up-- doesn't occur. Now, since down<up, so x[down] and x[up] are exchanged. Now arrangement is {10,7,2,17,3,11,7,19}. Again this loop'll be executed... thus at final step in 1st partition-stage u'll get {3,7,2,10,17,11,19}. Just follow the program & apply it on this. Go through the book on Data-Structures by Tanenbaum. There u'll ge step-by-step worked-out examples.
205086
For existing programs that do this, see PSLIST and ProcessExplorer.  \n\nTo write your own in C++, see this great Code Project article by Ahmed Yassin: http://www.codeproject.com/threads/Tasks.asp\n\nA comment at the end of the article mentions 3 other ways to do it as well:\n\n1. ToolHelp \n2. PSAPI\n3. Read Registry (check platform SDK sample PView)\n4. some function exported by ntdll.dll \n\nAlso see the MSDN help on the functions used in Ahmed's article.\n\nGood luck!
329287
Dude,\n  Are you doing this for homework or to build a relational database?  Er, I am the second answer.  Funny enough, I make console video games.  Yeah, weird, eh?\n\nhttp://www.cs.ualberta.ca/~joe/Research/binary.html\n(this one is, well, um, interesting) http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/solutions/November2005.html\n\nBut here is what you want:\nhttp://math.hws.edu/eck/cs225/s03/binary_trees/\n\nSome more:\nhttp://www.codeproject.com/cpp/BinaryTree.asp\n\nAnd more people like you asking about assignments on homework:\nhttp://forum.pcvsconsole.com/viewthread.php?tid=13817\n\nMore easy to read:\nhttp://www.faqts.com/knowledge_base/view.phtml/aid/25923\n\nThen, the usual:\nhttp://en.wikipedia.org/wiki/Binary_trees
311681
class publication\n{\n   private :\n      char title[20];\n      float price;\n   public :\n      void getdata()\n      {\n          cin>>title;\n          cin>>price;\n      }\n};\nclass books :: public publication\n{\n   private :\n      int pagecount;\n   public :\n      void getdata()\n      {\n          cin>>pagecount;\n      }\n\n};\nclass tape :: public publication\n{\n   private :\n      int playing_time;\n   public :\n      void getdata()\n      {\n          cin>>playing_time;\n      }\n};