ultravnc 反向连接_C程序以反向显示链接列表
ultravnc 反向连接
Problem statement: Write a program to display the linked list in reverse order. Note that the original linked list will not change.
问题陈述:编写一个程序以相反的顺序显示链接列表。 请注意,原始链表不会更改 。
Solution
解
Create and build the linked list
创建并建立链接列表
Display the original linked list
显示原始链表
Display in reverse order
反向显示
Displaying in reverse order can be done using recursive function.
可以使用递归功能以相反的顺序显示。
Function reverse_display(node)
IF (node!= NULL)
reverse_display(node->next)
display node value
END IF
Example with Explanation:
解释示例:
Let's check how the program runs...
让我们检查程序的运行方式...
Let the input linked list to be: 1->2->3->4->NULL with head at 1
让输入链接列表为: 1-> 2-> 3-> 4-> NULL,head为1
In Main() it calls
reverse_display(1)
----------------------------------------------------------------
reverse_display(1):
node is not null
reverse_display(1->next) thus it calls reverse_display(2)
----------------------------------------------------------------
reverse_display(2):
node is not null
reverse_display(2->next) thus it calls reverse_display(3)
----------------------------------------------------------------
reverse_display(3):
node is not null
reverse_display(3->next) thus it calls reverse_display(4)
----------------------------------------------------------------
reverse_display(4):
node is not null
reverse_display(4->next) thus it calls reverse_display(NULL)
----------------------------------------------------------------
reverse_display(NULL):
node is null
no further call, control returned to reverse_display(4)
----------------------------------------------------------------
At reverse_display(4)
Control returned from reverse_display(4->next)
So it prints the node value that is 4
Control returns to reverse_display(3)
----------------------------------------------------------------
At reverse_display(3)
Control returned from reverse_display(3->next)
So it prints the node value that is 3
Control returns to reverse_display(2)
----------------------------------------------------------------
At reverse_display(2)
Control returned from reverse_display(2->next)
So it prints the node value that is 2
Control returns to reverse_display(1)
----------------------------------------------------------------
At reverse_display(1)
Control returned from reverse_display(1->next)
So it prints the node value that is 1
Control returns to Main function
Thus it displays 4 3 2 1
C实现以反向显示链接列表 (C implementation to display Linked List in Reverse)
#include <stdio.h>
#include <stdlib.h>
struct node{int data; // data field
struct node *next;
};
void display(struct node* head){struct node* current=head; // current node set to head
printf("traversing the list...\n");
while(current!=NULL){ //traverse until current node isn't NULL
printf("%d ",current->data);
current=current->next; // go to next node
}
}
void reverse_display(struct node* head){if(head){//recursive call to display in reverse order
reverse_display(head->next);
printf("%d ",head->data);
}
}
struct node* creatnode(int d){struct node* temp=malloc(sizeof(struct node));
temp->data=d;
temp->next=NULL;
return temp;
}
int main(){printf("creating the linked list by inserting new nodes at the end\n");
printf("enter 0 to stop building the list, else enter any integer\n");
int k,count=1,x;
struct node* curr,*temp;
scanf("%d",&k);
struct node* head=creatnode(k); //buliding list, first node
scanf("%d",&k);
temp=head;
///inserting at the end//
while(k){curr=creatnode(k);
temp->next=curr;//appending each node
temp=temp->next;
scanf("%d",&k);
}
display(head); // displaying the list
printf("\ndisplaying in reverse order...\n");
reverse_display(head);//display in reverse order
return 0;
}
Output
输出量
First run:
creating the linked list by inserting new nodes at the end
enter 0 to stop building the list, else enter any integer
1 2 3 4 0
traversing the list...
1 2 3 4
displaying in reverse order...
4 3 2 1
Second run:
creating the linked list by inserting new nodes at the end
enter 0 to stop building the list, else enter any integer
34 55 2 4 76 -8 6 0
traversing the list...
34 55 2 4 76 -8 6
displaying in reverse order...
6 -8 76 4 2 55 34
翻译自: https://www.includehelp.com/c-programs/display-a-linked-list-in-reverse.aspx
ultravnc 反向连接
ultravnc 反向连接_C程序以反向显示链接列表相关推荐
- c语言 字符串字符反向储存_C ++中的反向字符串
c语言 字符串字符反向储存 In many situations, we may need to reverse a string in C++ programming. It may include ...
- UltraVNC反向连接方式的使用
UltraVNC是一款免费的远程连接软件,功能强大而且非常高效,这里介绍一种UltraVNC的反向连接方式,可以方便的对目标计算机进行控制. 一.为什么要使用反向连接 被监控端网络环境不确定,内网可 ...
- isam 驱动程序 下载_将ISAM反向代理配置为与OpenID连接提供程序的PEP
isam 驱动程序 下载 注意:截至2017年5月9日,"执行测试流程"部分(在"步骤2.将反向代理配置为OpenID Connect的联系点"部分中)下的代码 ...
- 如何基于Python写一个TCP反向连接后门
0x0 介绍 在Linux系统做未授权测试,我们须准备一个安全的渗透环境,通常第一件事就是安装虚拟机.且在攻击阶段中还需要对受害系统进行控制.常见的后门大多数是利用Metasploit生成,而目前反病 ...
- 查出反向木马的反向连接域名
反向木马的主要种植手段是通过IE的众多漏洞,bt下载时不小心运行,或者来路不明的软件,使未打补丁的用户点击之后下载运行了木马程序,而这些用户基本都是拥有动态IP的个人用户,若不使用反向连接的方式,势必 ...
- Python攻防-Socket通信建立TCP反向连接
文章目录 前言 远程控制 脚本编写 效果演示 脚本优化 getopt () 完整代码 效果演示 前言 本文将记录学习基于 Socket 通信机制建立 TCP 反向连接,借助 Python 脚本实现主机 ...
- 一个简单的反向连接服务程序
一个简单的反向连接服务程序 功能简介: 运行后自删除,写注册表Run下,同时自拷贝到系统目录下,注册为系统服务SvrDemo,修改文件时间同Cmd.exe,每隔俩秒钟连接一次本地(127.0.0.1) ...
- 小程序nginx做反向代理_NGINX作为节点或Angular应用程序的反向代理
小程序nginx做反向代理 A reverse proxy is a server that retrieves resources for clients from one or more upst ...
- 使用ssh正向连接、反向连接、做socks代理的方法
文章出处:http://dzmailbox.blog.163.com/blog/static/120534385201232642637847/ 最近才发现ssh有多么的强大! 在网上搜了半天,发现大 ...
- http反向连接技术
常见的普通木马,是安装在用户计算机里的一 段服务程序,而攻击者控制的则是相应的客户端程 序.服务程序通过特定的端口,打开用户计算机的 连接资源.一旦攻击者所掌握的客户端程序发出请 求,木马便和他连接起 ...
最新文章
- Linux futex 快速同步互斥机制简介
- 【机器学习】线性回归之Normal Equation(矩阵求导与线性代数视角)
- node --- 在node中使用mongoosemongoDB的安装
- php自然排序法的比较过程,PHP中strnatcmp()函数“自然排序算法”进行字符串比较用法分析(对比strcmp函数)...
- python类怎么实例化rnn层_Python backend.rnn方法代码示例
- spring-data-jpa 查询视图
- .Net字符暂存池(String Intern Pool)
- MFCC特征提取过程详解
- 正确绑定键盘事件_事件为何重要以及如何正确处理
- 计算机网络中的基本概念
- windows msiexec quiet静默安装及卸载msi软件包
- MySQL — 使用命令创建数据库、链接数据库、创建表、查询表数、删除表
- VB6之从1970年1月1日起的秒数 的与C语言类似的时间函数
- C语言libxml用法,c语言libxml2库的安装和使用.....
- Java 读取jpeg图片 Unsupported Image Type 异常
- 卫星高度角和方位角的计算
- HDUOJ1234开门人和关门人
- 基于UDP/IP协议的聊天室
- PHP 生成随机号段的电话号码,PHP手机号正则(多号段)
- 欢迎大家关注我创办的北京圣思园科技有限公司IT高端就业培训