Find Jobs
Hire Freelancers

akproj

$30-50 USD

已完成
已发布大约 22 年前

$30-50 USD

货到付款
The Problem Write a pair of procedures that pickle and unpickle graph data structures. The procedures have the prototypes void pickle_graph(const std::string & fname, const graph_node * root); graph_node * unpickle_graph(const std::string & fname); The fname argument gives the name of the file to which the graph will be pickled or from which the graph will be unpickled. Each file contains one graph. Any errors that occur during file operations should result in an informative error message and program termination. The root argument to pickle_graph() is a node from the graph to pickle (despite the suggestive name, the graph need not be a tree). Only those nodes reachable from the root need to be pickled. Given a file name f, the node returned by unpickle_graph() should be the equivalent to the node passed into the most recent invocation of pickle_graph() with the same file name f. A graph is constructed from nodes with the structure struct graph_node { pickleable * data_ptr; std::vector children; }; all nodes in a graph are graph_nodes. A graph node may have any number of children, including none; the left-to-right order of children in a graph node is significant. Edges are directed; they point to the children but not back to the [login to view URL] file graph.h contains declarations for graph_node, pickle_graph(), and unpickle_graph(). The data stored in each graph node can be pickled and unpickled by calling the the member functions void pickleable::pickle(std::ostream &); void pickleable::unpickle(std::istream &); The data to pickle is written to the given ostream; the data to unpickle is read from the given istream. These member functions are defined in /e pickle.h [login to view URL] contains some simple driver code to test your routines. This code is not the code I'll use to test your assignment; in particular, your routines should work for arbitrary graphs, not just trees. The graph returned by unpickle_graph() should be equivalent to the graph passed into pickle_graph(). Two graphs are equivalent if there exists a one-to-one correspondence between the nodes and edges of one graph and the nodes and edges of the other graph. Two nodes are equivalent if they have the same data and the their children are equivalent in the left-to-right order given in each node. Two edges are equivalent if the nodes at their heads and tails are equivalent. -------------------------------- ## Deliverables Complete and fully-functional working program using C++ in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. ## Platform Unix,Sun solaris,LInux ## Deadline information Must be checked,tested and documneted properly
项目 ID: 2845681

关于此项目

5提案
远程项目
活跃22 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
See private message.
$19.55 USD 在14天之内
5.0 (47条评论)
4.5
4.5
5威客以平均价$26 USD来参与此工作竞价
用户头像
See private message.
$34 USD 在14天之内
5.0 (43条评论)
4.8
4.8
用户头像
See private message.
$25.50 USD 在14天之内
4.9 (6条评论)
1.5
1.5
用户头像
See private message.
$25.50 USD 在14天之内
5.0 (4条评论)
0.4
0.4
用户头像
See private message.
$25.50 USD 在14天之内
0.0 (1条评论)
0.8
0.8

关于客户

UNITED STATES的国旗
United States
5.0
5
会员自3月 28, 2002起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。