| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 635 人关注过本帖
标题:一个数据结构的编程!!
只看楼主 加入收藏
wpscced
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-7-27
收藏
 问题点数:0 回复次数:2 
一个数据结构的编程!!

// shujujiegou.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

typedef struct _entry {
int key;
int data;
char name[20];
struct _entry * next;
} entry, * entry_ptr;


/*

This function inserts an entry into an ordered, singly linked list.
Each entry in the list is a structure that contains an integer key value,
a next pointer, and some other data.

The head of the linked list is saved in a pointer that is stored outside
the list itself. Within the list, the next pointer in each entry points
to the next element in the list. The end of the linked list is denoted
by the next pointer of the last entry being set to NULL.

The order of the list is determined by the key value. Entries with a lower
key value appear earlier in the list.The function is passed a pointer to the
structure that will be inserted as the new entry. The code reads the key value to determine the proper order in the list, sets the next pointer as needed, and does not change any other elements in the structure.

The function is also passed a pointer to the current head of the list, a
nd it returns the new head of the list, because this changes if the new entry needs to be inserted at the head of the list.

*/

entry_ptr insert_linked_list( entry * current_head, entry * new_element)
{

}

int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

小弟看得似懂非懂,望大家给帮帮忙,给解释解释要达到的目的也行!!谢谢各位了

搜索更多相关主题的帖子: 数据结构 
2006-07-27 22:49
热情依然
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:22
帖 子:715
专家分:0
注 册:2005-4-5
收藏
得分:0 
这个是一个单链表而已,只不过插入的顺序取决于"key"这个int 变量,也就是每插入一个元素,就比较一下key值,使这个单链表永远保存有序

c++/C + 汇编 = 天下无敌
2006-07-28 08:30
热情依然
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:22
帖 子:715
专家分:0
注 册:2005-4-5
收藏
得分:0 
至于这句 int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

你就看成是 int main(int argc,char *argv[])
           {
                return 0;
           }
就可以了,因为你这个项目是用vc6.0来生成的

c++/C + 汇编 = 天下无敌
2006-07-28 08:34
快速回复:一个数据结构的编程!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056372 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved