3
29
2011
37

算法初步,链表与约瑟夫环的求解

最近在研究数据结构和简单算法,为了准备某某东西嘛,就不说出来了,因为是新手,而且和也可能和我的学习方法以及悟性有关

感觉一直很颓废,写起来没有那么生动,思考的时候容易遇到瓶颈,而且我感觉算法和数据结构这种东西不是突击就可以出来的,

不过最近我又开始加班了,以后打算长期写下去,希望这个家可以长久一点,一开始本来是在本地计算机的虚拟机里搭建WP的,只是想有个稳定点的家而已。

关于链表的结构还是比较清晰的,就是类似数组类型的简单数据结构,但是在运算以及存储操作等方法上要优于数组,特别是在使用

C/CPP这样的比较接近底层的语言中,因为语言本身没有比较好的高级数据结构,不过就链表的实现来说还是很方便的,在我书写的过程中,主要遇到的困难是,链表指针的传递问题,有好几次我的指针都不知道指向了什么地方,经过相当长时间的刻苦调试终于有了进展,不过参看别人的链表结构我感觉自己的结构还是相当幼稚的,这是我今天做的总结。

下面上程序,希望自己能快点进步,能成为一名ios开发者,加油!

 

//蒙特卡洛方法求PI
//原题出自编程之美,但是算法有误,
//我的是改正过的
//但是方法可能有问题,精确度不是很好,不过还是发上来了,供我以后该进研究
//designed by YoungEr.ShEn
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define N 500000

double rand_num()
	{
	
		srand(time(NULL));
		double f;

		f=double((rand()/RAND_MAX));
		f/=100;
	
		return f;
	}
int main(int argc,char ** argv)
{
	int i=0;
	int caseSum=0;
	double temp1;
	double temp2;
	for(;i<N;i++)
		{
			temp1=rand_num();
			temp2=rand_num();
			if((temp1*temp1+temp2*temp2) <1)caseSum++;
		}
	double PIs;
	PIs=(double)((caseSum/N));
	PIs*=4;
	printf("number PI is %f\n",PIs);
	printf("%f\n",rand_num());
	printf("%ld\n",caseSum);
	printf("%f",RAND_MAX);



}

 

Category: 算法研究 | Tags: c/c++ 算法 | Read Count: 1305
Avatar_small
seo service london 说:
2024年1月13日 23:12

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates

Avatar_small
오락실도메인 说:
2024年1月17日 19:09

you’re in point of fact a good webmaster. The website loading velocity is amazing. It seems that you’re doing any distinctive trick. In addition, The contents are masterpiece. you’ve done a great activity on this subject!

Avatar_small
온라인카지노순위 说:
2024年1月17日 20:11

Greatest fighter toasts ought to entertain and supply prize on your couples. Initially audio system next to obnoxious crowd would be wise to understand one particular gold colored strategy as to public speaking, which is personal interests self. best man jokes  

Avatar_small
스포츠토토사이트 说:
2024年1月17日 20:29

Hello there, just became aware of your blog through Google, and found that it is truly informative. I’m going to watch out for brussels. I’ll be grateful if you continue this in future. Numerous people will be benefited from your writing. Cheers!

Avatar_small
인터넷바카라 说:
2024年1月17日 20:33

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

Avatar_small
스포츠토토용어 说:
2024年1月17日 21:08

Some Safety Precautions to take while plying Airsoft  1. Always take care of your airsoft gun. Clean it well with cloth, after each game. Lubricate the internal parts of the gun with SILICONE SPRAY! 2. Know what you want when buying airsoft. Heavier BB's weigh more. Though the weight makes them target more accurately, they are not as far or fast. Lighter BB's like .12 and .20 travel further and faster but are less accurate. .23 though are really hard to find, gives you both fastness and accuracy. Selecting the right BB for the job will give you satisfaction in the game. Do not buy less than a .20 for use in an AE.

Avatar_small
벳썰인증업체 说:
2024年1月17日 21:21

Greatest fighter toasts ought to entertain and supply prize on your couples. Initially audio system next to obnoxious crowd would be wise to understand one particular gold colored strategy as to public speaking, which is personal interests self. best man jokes  

Avatar_small
MX카지노주소 说:
2024年1月17日 21:21

i read a ton of stuff and i found that the method for composing to clearifing that precisely need to say was great so i am inspired and ilike to come back again in future..

Avatar_small
국내 온라인카지노 说:
2024年1月17日 21:39

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Avatar_small
먹튀폴리스주소 说:
2024年1月17日 21:42

A bullet proof vest is also known as body armor. This protective clothing protects the wearer from a bullet injury and is usually worn by policemen and military officers. In many places, it is legal to own a bullet proof vest by any citizen who abides by the law.  

Avatar_small
วิธีใช้งานคาสิโนออนไ 说:
2024年1月17日 21:48

Awesome material you fellas got these. I actually like the theme for the website along with how you organized a person who. It’s a marvelous job For certain i will come back and check out you out sometime

Avatar_small
안전놀이터추천 说:
2024年1月17日 21:55

You actually make it seem so easy with your presentation but I find this topic to be really something that I think I would never understand. It seems too complicated and very broad for me. I’m looking forward for your next post, I’ll try to get the hang of it! 

Avatar_small
안전놀이터 说:
2024年1月17日 22:06

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Avatar_small
파워볼 说:
2024年1月17日 22:12

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively  

Avatar_small
토토은어 说:
2024年1月17日 22:17

“I’m also writing to let you be aware of of the wonderful encounter our child had viewing your web page. She came to find several details, including how it is like to have a very effective giving nature to get many more without problems have an understanding of specified impossible subject matter. You actually exceeded our desires. Many thanks for churning out such insightful, trusted, explanatory and also fun tips about this topic to Jane.”  

Avatar_small
안전놀이터 说:
2024年1月17日 22:27

Howdy! Quick question that’s completely off topic. Do you know how to make your site mobile friendly? My website looks weird when viewing from my iphone. I’m trying to find a template or plugin that might be able to fix this problem. If you have any recommendations, please share. Cheers! 

Avatar_small
안전놀이터 说:
2024年1月18日 01:16

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively   

Avatar_small
먹튀사이트목록 说:
2024年1月18日 01:20

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively    

Avatar_small
토토사이트 说:
2024年1月18日 01:44

What¡¦s Happening i’m new to this, I stumbled upon this I’ve found It positively helpful and it has helped me out loads. I am hoping to give a contribution & aid different customers like its aided me. Good job.

Avatar_small
안전한 보증업체 说:
2024年1月18日 01:56

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively   

Avatar_small
메이저사이트 说:
2024年1月18日 02:07

Some Safety Precautions to take while plying Airsoft  1. Always take care of your airsoft gun. Clean it well with cloth, after each game. Lubricate the internal parts of the gun with SILICONE SPRAY! 2. Know what you want when buying airsoft. Heavier BB's weigh more. Though the weight makes them target more accurately, they are not as far or fast. Lighter BB's like .12 and .20 travel further and faster but are less accurate. .23 though are really hard to find, gives you both fastness and accuracy. Selecting the right BB for the job will give you satisfaction in the game. Do not buy less than a .20 for use in an AE.

Avatar_small
먹튀검증업체 说:
2024年1月18日 02:10

A powerful share, I simply given this onto a colleague who was doing slightly analysis on this. And he in actual fact purchased me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I really feel strongly about it and love studying more on this topic. If doable, as you turn into expertise, would you mind updating your blog with extra particulars? It is highly useful for me. Massive thumb up for this weblog post!  

Avatar_small
먹튀검증업체 说:
2024年1月18日 02:15

Greatest fighter toasts ought to entertain and supply prize on your couples. Initially audio system next to obnoxious crowd would be wise to understand one particular gold colored strategy as to public speaking, which is personal interests self. best man jokes  

Avatar_small
안전놀이터가입 说:
2024年1月18日 02:27

I’m impressed, I must say. Really rarely must i encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail around the head. Your thought is outstanding; the issue is an element that too few persons are speaking intelligently about. I will be very happy that I came across this during my search for some thing regarding this. 

Avatar_small
토토사이트 说:
2024年1月18日 02:30

Some Safety Precautions to take while plying Airsoft  1. Always take care of your airsoft gun. Clean it well with cloth, after each game. Lubricate the internal parts of the gun with SILICONE SPRAY! 2. Know what you want when buying airsoft. Heavier BB's weigh more. Though the weight makes them target more accurately, they are not as far or fast. Lighter BB's like .12 and .20 travel further and faster but are less accurate. .23 though are really hard to find, gives you both fastness and accuracy. Selecting the right BB for the job will give you satisfaction in the game. Do not buy less than a .20 for use in an AE.

Avatar_small
오래된토토사이트주소 说:
2024年1月18日 02:40

Pretty useful article. I simply stumbled upon your net site and wanted to mention that I’ve very preferred learning your blog posts. Any signifies I’ll be subscribing together with your feed and I wish you put up as soon as extra quickly. sbobet

Avatar_small
토토사이트추천 说:
2024年1月18日 02:47

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively   

Avatar_small
메이저놀이터주소 说:
2024年1月18日 02:54

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Avatar_small
메이저놀이터주소 说:
2024年1月18日 02:58

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Avatar_small
카지노를부탁해 说:
2024年1月18日 03:16

A bullet proof vest is also known as body armor. This protective clothing protects the wearer from a bullet injury and is usually worn by policemen and military officers. In many places, it is legal to own a bullet proof vest by any citizen who abides by the law.  

Avatar_small
토토사이트추천 说:
2024年1月18日 03:19

I’m really inspired together with your writing abilities and also with the layout to your weblog. Is this a paid subject matter or did you customize it yourself? Either way keep up the excellent high quality writing, it is uncommon to see a nice weblog like this one nowadays..

Avatar_small
먹튀신고 说:
2024年1月18日 03:28

This is the appropriate weblog for everyone who hopes to check out this topic. You already know a lot its practically hard to argue on hand (not that I actually would want…HaHa). You certainly put a different spin for a topic thats been written about for several years. Wonderful stuff, just fantastic

Avatar_small
토토 배너 제작 说:
2024年1月18日 03:34

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Avatar_small
먹튀신고 说:
2024年1月18日 03:39

I’m impressed, I must say. Really rarely must i encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail around the head. Your thought is outstanding; the issue is an element that too few persons are speaking intelligently about. I will be very happy that I came across this during my search for some thing regarding this. 

Avatar_small
먹튀검증사이트 说:
2024年1月18日 03:45

There are some interesting cut-off dates on this article but I don know if I see all of them center to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as effectively   

Avatar_small
토토사이트추천 说:
2024年1月18日 03:59

Yes i am completely concurred with this article and i simply need say this article is extremely decent and exceptionally useful article.I will make a point to be perusing your blog more. You made a decent point yet I can"t resist the urge to ponder, shouldn"t something be said about the other side?

Avatar_small
먹튀사이트 说:
2024年1月18日 04:02

A bullet proof vest is also known as body armor. This protective clothing protects the wearer from a bullet injury and is usually worn by policemen and military officers. In many places, it is legal to own a bullet proof vest by any citizen who abides by the law.  


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com