/* A custom doubly linked list implemenation */

 # include <stdio.h>
# include <stdlib.h>
# include <math.h> # include "global.h"
# include "rand.h" /* Insert an element X into the list at location specified by NODE */
void insert (list *node, int x)
{
list *temp;
if (node==NULL)
{
printf("\n Error!! asked to enter after a NULL pointer, hence exiting \n");
exit();
}
temp = (list *)malloc(sizeof(list));
temp->index = x;
temp->child = node->child;
temp->parent = node;
if (node->child != NULL)
{
node->child->parent = temp;
}
node->child = temp;
return;
} /* Delete the node NODE from the list */
list* del (list *node)
{
list *temp;
if (node==NULL)
{
printf("\n Error!! asked to delete a NULL pointer, hence exiting \n");
exit();
}
temp = node->parent;
temp->child = node->child;
if (temp->child!=NULL)
{
temp->child->parent = temp;
}
free (node);
return (temp);
}
typedef struct lists
{
int index;
struct lists *parent;
struct lists *child;
} list;

list  结构体中有两个指针,可构成双向链表,数值空间存放   索引序号  。

insert  函数

申请一块新的内存空间,放在在 list  指针   指向的空间之后。

del  函数

将  list  指向 的个体空间释放。

以上两个操作在插入,删除操作后都有修改指针操作,保证原有链表 的  上下链接正常。

多目标遗传算法 ------ NSGA-II (部分源码解析)辅助变量 双链表操作 list.c的更多相关文章

  1. 多目标遗传算法 ------ NSGA-II (部分源码解析)介绍

    NSGA(非支配排序遗传算法).NSGA-II(带精英策略的快速非支配排序遗传算法),都是基于遗传算法的多目标优化算法,是基于pareto最优解讨论的多目标优化. 在官网: http://www.ii ...

  2. 多目标遗传算法 ------ NSGA-II (部分源码解析) 交叉操作 crossover.c

    遗传算法中的交叉操作是 对NSGA-II  源码分析的  最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的  函数模块. 这里,首先提一下,遗传算法的  交叉操作.变异操作都 ...

  3. 多目标遗传算法 ------ NSGA-II (部分源码解析)目标函数 problemdef.c

    /* Test problem definitions */ # include <stdio.h> # include <stdlib.h> # include <ma ...

  4. 多目标遗传算法 ------ NSGA-II (部分源码解析)状态报告 打印 report.c

    /* Routines for storing population data into files */ # include <stdio.h> # include <stdlib ...

  5. 多目标遗传算法 ------ NSGA-II (部分源码解析) 拥挤距离计算 crowddist.c

    /* Crowding distance computation routines */ # include <stdio.h> # include <stdlib.h> # ...

  6. 多目标遗传算法 ------ NSGA-II (部分源码解析)README 算法的部分英文解释

    This is the Readme file for NSGA-II code. About the Algorithm--------------------------------------- ...

  7. 多目标遗传算法 ------ NSGA-II (部分源码解析) 实数、二进制编码的变异操作 mutation.c

    遗传算法的变异操作 /* Mutation routines */ # include <stdio.h> # include <stdlib.h> # include < ...

  8. 多目标遗传算法 ------ NSGA-II (部分源码解析)两个个体支配判断 dominance.c

    /* Domination checking routines */ # include <stdio.h> # include <stdlib.h> # include &l ...

  9. 多目标遗传算法 ------ NSGA-II (部分源码解析)二元锦标赛选择 tourselect.c

    tourselect.c  文件中共有两个函数: selection (population *old_pop, population *new_pop) individual* tournament ...

  10. 多目标遗传算法 ------ NSGA-II (部分源码解析) 临时种群生成新父代种群 fillnds.c

    /* Nond-domination based selection routines */ # include <stdio.h> # include <stdlib.h> ...

随机推荐

  1. Oracle 转移符问题

    注:select '''' from dual;    --输出一个单引号      select '''''' from dual;   --输出两个单引号      select '''''''' ...

  2. MySQL基础知识——范式与事务

    几个概念 在说范式之前,要先了解几个概念: 关系模式 关系模式的5要素:R(U,D,DOM,F) 用下面这个category表来理解上面这个式子 mysql> desc student; +-- ...

  3. Java的常用命令javac与java

    javac 可以使用javac -h来查看常用的命令: -> ~ # javac -help 用法: javac <options> <source files> 其中, ...

  4. NodeJS简记

    C:\Users\Administrator>node > .help .break Sometimes you get stuck, this gets you out .clear A ...

  5. kali linux升级

    自己使用的是2017.2 版本的kali linux 想着升级一下 里面的包 比如msf 等 但是执行 msfupdate时提示 root@kali201702:~# msfupdate msfupd ...

  6. Angular 简单的Post

    <!DOCTYPE html><html ng-app="myApp"><head lang="en"> <meta ...

  7. 周刷题第一期总结(two sum and two numbers)

    由于深深的知道自己是事件驱动型的人,一直想补强自己的薄弱环节算法,却完全不知道从哪里入手.所以只能采用最笨的办法,刷题.从刷题中遇到问题就解决问题,最后可能多多少少也能提高一下自己的渣算法吧. 暂时的 ...

  8. html5 视频和音频

    视频:html5支持视屏文件或者视屏流. html5使用video元素来播放视屏,支持的类型有OGG,MEPG 4,webM,但是不同的浏览器支持类型不同. src可以放置视屏文件的路径,可以使用元素 ...

  9. query的set能添加多个

  10. Layui_HDFS目录(上传,下载,删除,分页,下级目录,键盘控制返回上一页)

    注:转载请署名 一.实体 package com.ebd.application.modules.fileManage.pojo; public class FilesOrDirs { private ...