自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Happy_hui520的博客

积极乐观的面对每一天!

  • 博客(14)
  • 资源 (9)
  • 收藏
  • 关注

原创 验证回文串-LeetCode(初级算法)

这题比较简单,写博客的主要目的是提醒自己注意一个细节问题。题目https://leetcode-cn.com/leetbook/read/top-interview-questions-easy/xne8id/参考代码:class Solution {public: bool isPalindrome(string s) { int L=s.size(); if(L==1) return true; for(int ..

2022-04-04 18:51:10 592 2

原创 1042 Shuffling Machine (20 分) PAT (Advanced Level) Practice 解析

1042Shuffling Machine(20分)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where ...

2019-09-10 18:07:35 283

原创 1018 锤子剪刀布 (20 分) PAT (Basic Level) Practice (中文)两种实现方式

1018锤子剪刀布(20分)大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第 1 行给出正整数N(≤10​5​​),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代...

2019-09-10 16:46:04 459

原创 ccf认证 模拟题 试题编号: 201812-2 试题名称:小明放学 Python版答案(100分)

和上一个小明上学的规则一样,红绿黄是一个循环。处理不同路口红绿灯的方法:走到每个路口时,把相应的等待时间化成绝对时间,然后对循环(r+g+y)取模,求剩余等待时间每个路口的时间转换为0 10250 11610 60 3500 3然后加上当前时间sum,计算所属区间和等待时间即可。r, y, g = [int(i) for i in input(...

2019-08-26 21:06:06 405

原创 ccf csp 计算机软件能力认证 201903-2 二十四点 1.0s 512.0MB Python版答案(模拟栈实现)

第一次试过通过分类的方式,分成几种模式处理,结果发现越弄越麻烦,最后放弃了改用模拟栈实现,发现很自然也很正确。Python语言的可读性很高,简单说一下思路吧: 数字和操作符列表模拟栈,从左到右扫描表达式,遇到 'x' (这个要注意! 我竟然看成了 '*' ,第一次只得了40分emmmm)或 '/' 就取出俩数字做运算,然后把结果放回去。然后把操作符列表里的 '-' 对应的数字变成负数,最后...

2019-08-07 21:24:58 493

原创 ccf csp 计算机软件能力认证 模拟题 201903-1 小中大 1.0s 512.0MB Python、C++版答案

刚看到这个题的时候以为10分钟就能做出来,但是还是有坑的,不小心的话总是无法全对,还是做了好一会儿。先放C++版的答案,代码简洁,思路简单。#include<iostream>#include<iomanip>using namespace std;int main(){ int Max,Min,n,flag=0; double Mid...

2019-08-07 16:50:12 842

原创 有道翻译爬虫(Python3) 破解js加密 {'errorCode': 50}

2019/7/15发现之前写的有道翻译爬虫不能用了,老是报 {'errorCode': 50},用Fiddler检查了一下收发包,没发现header或者data有什么问题。从网上找了一下有道翻译反爬虫的答案,思路都差不多,但解决不了问题。刚才突然想到可能是加密内容变了(毕竟很好实现,改个常量就行),我就查看了有道翻译的js文件,搜索了一下关键字就发现问题所在了,...

2019-07-16 00:18:56 474

原创 TensorFlow + Keras 图像识别:Dogs vs Cats Image Classification(Transfer Learning using MobileNet)

OS:Win10Interpreter: Python3.7Environment: Anaconda3 + Tensorflow-gpu2.0.0 + Spyder +Tensorflow_hub5.0.0API: tf.keras(a high-level API to build and train models in TensorFlow)和上一个项目(https://...

2019-07-14 00:10:51 1007

原创 TensorFlow + Keras 图像识别:Dogs vs Cats Image Classification with data augmentation(CNN, 解决过拟合问题)

OS:Win10Interpreter: Python3.7Environment: Anaconda3 + Tensorflow-gpu2.0.0 + SpyderAPI: tf.keras(a high-level API to build and train models in TensorFlow)项目源码参考自TensorFlow官方教程https://colab.r...

2019-07-11 17:41:16 1962

原创 TensorFlow + Keras 入门项目:Image Classification with CNN(基于Fashion-MNIST数据集)

OS:Win10Interpreter: Python3.7Environment: Anaconda3 + Tensorflow-gpu2.0.0 + Spyder+cuda10.0+cudnn7.6API: tf.keras(a high-level API to build and train models in TensorFlow)上一篇博客https://blog.c...

2019-07-10 16:58:30 806

原创 TensorFlow + Keras 入门项目:Classifying Images of Clothing(基于Fashion-MNIST数据集)

OS:Win10Interpreter: Python3.7Environment: Anaconda3 + Tensorflow-gpu2.0.0 + SpyderFashion-MNIST 数据集简介:https://github.com/zalandoresearch/fashion-mnist'Fashion-MNIST is a dataset of Zalan...

2019-07-10 00:30:09 1032 2

原创 TensorFlow 2.0.0(TensorFlow1.xx也可以用)+ Kears 测试、入门例程 (摄氏度-华氏度转换 )

系统: win10环境:Anaconda+Spyder+python3.7安装:tensorflow2.0测试有如下输出,证明TensorFlow配置好GPU了,就可以正常使用。下面的警告不用在意,因为我们定义了一个tf的空函数做测试。(tf2.0) C:\Users\DELL>pythonPython 3.7.3 (default, Apr 24 201...

2019-07-09 14:24:18 3715

原创 ImportError: DLL load failed 高效解决方法 Win10+Python3.7+Anaconda2019.03+tensorflow-gpu2.0/1.14+CUDA10.0

存在的问题 ImportError: DLL load failed: 找不到指定的模块。安装tensorflow-gpu很容易因为版本不兼容和缺少运行时环境(动态链接库.dll)而出问题,但是我按正确版本安装(期间更换了tensorflow和cuda、cudnn的版本)还是多次出现了“ImportError: DLL load failed: 找不到指定的模块。”这个问题。我...

2019-07-03 12:53:47 14728 5

原创 PAT乙级真题及训练集 1006. 换个格式输出整数 (15)

1006. 换个格式输出整数 (15)让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。输出格式:每个测试用例的输出占一行,用规定的格式输出n。

2017-10-23 15:15:10 311

趣味C程序设计集锦.pdf

《趣味C程序设计集锦(爱上程序设计)》作为计算机C程序设计的科普读物与学习C语言程序设计的教学参考书,着眼于应用C程序设计求解问题的基本方法与技巧,提高通过C程序设计解决实际问题的能力。《趣味C程序设计集锦(爱上程序设计)》以各类趣题的C程序设计求解为主线,取材注重典型性与趣味性,程序注重结构化与可读性。所精选的趣解包括典型的数值求解、常见的数据处理、有趣的智力游戏、巧妙的模拟探索、新颖的图表创建,大多是引导入门的基础题、常规题,也适当设计少量难度较大的综合题与经典名题,难度适宜,深入浅出。

2017-09-12

数据结构与算法分析(C++描述)(第3版)-[美]Mark Allen Weiss, 中译版, 2006.pdf

Mark Allen Weiss教授撰写的数据结构与算法分析方面的著作曾被评为20世纪最佳的30部计算机著作之一,已经成为公认的经典之作,被全球数百所大学采用为教材,广受好评。 《数据结构与算法分析:C++描述》一书秉承Weiss著全一贯的严谨风格,同时又突出了实践。书中充分应用了现代C++语言特性,透彻地讲述了数据结构的原理和应用,不仅使学生具备算法分析能力,能够开发高效的程序,而且让学生掌握良好的程序设计技巧。 Chapter 1 Introduction 1 1.1 What's the Book About? 1 1.2 Mathematics Review 2 1.2.1 Exponents 3 1.2.2 kogarithms 3 1.2.3 Series 4 1.2.4 Modular Arithmetic 5 1.2.5 The P Word 6 1.3 A Brief Introduction to Recursion 7 1.4 C++ Classes 11 1.4.i Basic class Syntax 12 1.4.2 Extra Constructor Syntax and Accessors 12 1.4.3 Separation of Interface and Implementation 15 1.4.4 vector and string 17 1.5 C++ Details 19 1.5.1 Pointers 19 1.5.2 Parameter Passing 21 1.5.3 Return Passing 22 1.5.4 Reference Variables 23 1.5.5 The Big Three: Destructor, Copy Constructor, operator= 23 1.5.6 C-style Arrays and Strings 26 1.6 Templates 29 1.6.1 Function Templates 29 1.6.2 Class Templates 30 1.6.3 Object, Comparable, and an Example 32 1.6.4 Function Objects 34 1.6.5 Separate Compilation of Class Templates 35 1.7 Using Matrices 37 1.7.1 The Data Members, Constructor, and Basic Accessors 37 1.7.2 operator[] 37 1.7.3 Destructor, Copy Assignment, Copy Constructor 39 Summary 39 Exercises 39 References 41 Chapter 2 Algorithm Analysis 43 2.1 Mathematical Background 43 2.2 Model 46 2.3 What to Analyze 46 2.4 Running Time Calculations 49 2.4.1 A Simple Example 49 2.4.2 General Rules 50 2.4.3 Solutions for the Maximum Subsequence Sum Problem 52 2.4.4 Logarithms in the Running Time 58 2.4.5 Checking Your Analysis 62 2.4.6 A Grain of Salt 63 Summary 63 Exercises 64 References 69 Chapter 3 Lists, Stacks, and Queues 71 3.1 Abstract Data Types (ADTs) 71 3.2 The List ADT 72 3.2.1 Simple Array Implementation of Lists 72 3.2.2 Simple Linked Lists 73 3.3 vector and list in the STL 74 3.3.1 Iterators 75 3.3.2 Example: Using erase on a List 77 3.3.3 const iterators 77 3.4 Implementation of vector 79 3.5 Implementation of list 83 3.6 The Stack ADT 94 3.6.1 Stack Model 94 3.6.2 Implementation of Stacks 95 3.6.3 Applications 96 3.7 The Queue ADT 104 3.7.1 Queue Model 104 3.7.2 Array Implementation of Queues 104 3.7.3 Applications of Queues 106 Summary 107 Exercises 108 Chapter 4 Trees 113 4.1 Preliminaries 113 4.1.1 Implementation of Trees 114 4.1.2 Tree Traversals with an Application 115 4.2 Binary Trees 119 4.2.1 Implementation 120 4.2.2 An Example: Expression Trees 121 4.3 The Search Tree ADT Binary Search Trees 124 4.3.1 contains 125 4.3.2 findMin and findMax 125 4.3.3 insert 129 4.3.4 remove 130 4.3.5 Destructor and Copy Assignment Operator 132 4.3.6 Average-Case Analysis 133 4.4 AVL Trees 136 4.4.1 Single Rotation 139 4.4.2 Double Rotation 142 4.5 Splay Trees 149 4.5.1 A Simple Idea (That Does Not Work) 150 4.5.2 Splaying 152 4.6 Tree Traversals (Revisited) 158 4.7 B-Trees 159 4.8 Sets and Maps in the Standard Library 165 4.8.1 Sets 165 4.8.2 Maps 166 4.8.3 Implementation of set and map 167 4.8.4 An Example That Uses Several Maps 168 Summary 174 Exercises 174 References 181 Chapter 5 Hashing 185 5.1 General Idea 185 5.2 Hash Function 186 5.3 Separate Chaining 188 5.4 Hash Tables Without Linked Lists 192 5.4.1 Linear Probing 193 5.4.2 Quadratic Probing 195 5.4.3 Double Hashing 199 5.5 Rehashing 200 5.6 Hash Tables in the Standard Library 204 5.7 Extendible Hashing 204 Summary 207 Exercises 208 References 211 Chapter 6 Priority Queues (Heaps) 213 6.1 Model 213 6.2 Simple Implementations 214 6.3 Binary Heap 215 6.3.1 Structure Property 215 6.3.2 Heap-Order Property 216 6.3.3 Basic Heap Operations 217 6.3.4 Other Heap Operations 220 6.4 Applications of Priority Queues 225 6.4.1 The Selection Problem 226 6.4.2 Event Simulation 227 6.5 d-Heaps 228 6.6 Leftist Heaps 229 6.6.1 Leftist Heap Property 229 6.6.2 Leftist Heap Operations 230 6.7 Skew Heaps 235 6.8 Binomial Queues 239 6.8.1 Binomial Queue Structure 240 6.8.2 Binomial Queue Operations 241 6.8.3 Implementation of Binomial Queues 244 6.9 Priority Queues in the Standard Library 251 Summary 251 Exercises 251 References 257 Chapter 7 Sorting 261 7.1 Preliminaries 261 7.2 Insertion Sort 262 7.2.1 The Algorithm 262 7.2.2 STL Implementation of Insertion Sort 263 7.2.3 Analysis of Insertion Sort 264 7.3 A Lower Bound for Simple Sorting Algorithms 265 7.4 Shellsort 266 7.4.1 Worst-Case Analysis of Shellsort 268 7.5 Heapsort 270 7.5.1 Analysis of Heapsort 272 7.6 Mergesort 274 7.6.1 Analysis of Mergesort 276 7.7 Quicksort 279 7.7.1 Picking the Pivot 280 7.7.2 Partitioning Strategy 282 7.7.3 Small Arrays 284 7.7.4 Actual Quicksort Routines 284 7.7.5 Analysis of Quicksort 287 7.7.6 A Linear-Expected-Time Algorithm for Selection 290 7.8 Indirect Sorting 292 7.8.1 vector Does Not Work 295 7 8.2 Smart Pointer Class 295 7 8.3 Overloading operator< 295 7 8.4 Dereferencing a Pointer with * 295 7 8.5 Overloading the Type Conversion Operator 295 7 8.6 Implicit Type Conversions Are Everywhere 296 7 8.7 Dual-Direction Implicit Conversions Can Cause Ambiguities 296 7 8.8 Pointer Subtraction Is Legal 297 7.9 A General Lower Bound for Sorting 297 7.9.1 Decision Trees 297 7.10 Bucket Sort 299 7.11 External Sorting 300 7 11.1 Why We Need New Algorithms 300 7 11.2 Model for External Sorting 300 7 11.3 The Simple Algorithm 301 7 11.4 Multiway Merge 302 7 11.5 Polyphase Merge 303 7 11.6 Replacement Selection 304 Summary 305 Exercises 306 References 311 Chapter 8 The Disjoint Set Class 315 8.1 Equivalence Relations 315 8.2 The Dynamic Equivalence Problem 316 8.3 Basic Data Structure 317 8.4 Smart Union Algorithms 321 8.5 Path Compression 324 8.6 Worst Case for Union-by-Rank and Path Compression 325 8.6.1 Analysis of the Union~ind Algorithm 326 8.7 An Application 331 Summary 334 Exercises 335 References 336 Chapter 9 Graph Algorithms 339 9.1 Definitions 339 9.1.1 Representation of Graphs 340 9.2 Topological Sort 342 9.3 Shortest-Path Algorithms 345 9.3.1 Unweighted Shortest Paths 347 9.3.2 Dijkstra's Algorithm 351 9.3.3 Graphs with Negative Edge Costs 360 9.3.4 Acyclic Graphs 360 9.3.5 All-Pairs Shortest Path 364 9.3.6 Shortest Path Example 365 9.4 Network Flow Problems 367 9.4.1 A Simple Maximum-Flow Algorithm 367 9.5 Minimum Spanning Tree 372 9.5.1 Prim's Algorithm 373 9.5.2 Kruskal's Algorithm 376 9.6 Applications of Depth-First Search 378 9.6.1 Undirected Graphs 379 9.6.2 Biconnectivity 381 9.6.3 Euler Circuits 385 9.6.4 Directed Graphs 388 9.6.5 Finding Strong Components 390 9.7 Introduction to NP-Completeness 392 9.7.1 Easy vs. Hard 392 9.7.2 The Class NP 393 9.7.3 NP-Complete Problems 394 Summary 396 Exercises 396 References 404 Chapter 10 Algorithm Design Techniques 409 10.1 Greedy Algorithms 409 10.1.1 A Simple Scheduling Problem 410 10.1.2 Huffman Codes 413 10.1.3 Approximate Bin Packing 419 10.2 Divide and Conquer 427 10.2.1 Running Time of Divide and Conquer Algorithms 428 10.2.2 Closest-Points Problem 430 10.2.3 The Selection Problem 435 10.2.4 Theoretical Improvements for Arithmetic Problems 438 10.3 Dynamic Programming 442 10.3.1 Using a Table Instead of Recursion 442 10.3.2 Ordering Matrix Multiplications 444 10.3.3 Optimal Binary Search Tree 447 10.3.4 All-Pairs Shortest Path 451 10.4 Randomized Algorithms 454 10.4.1 Random Number Generators 455 10.4.2 Skip Lists 459 10.4.3 Primality Testing 461 10.5 Backtracking Algorithms 464 10.5.1 The Turnpike Reconstruction Problem 465 10.5.2 Games 469 Summary 475 Exercises 475 References 485 Chapter 11 Amortized Analysis 491 11.1 An Unrelated Puzzle 492 11.2 Binomial Queues 492 11.3 Skew Heaps 497 11.4 Fibonacci Heaps 499 11.4.1 Cutting Nodes in Leftist Heaps 500 11.4.2 Lazy Merging for Binomial Queues 502 11.4.3 The Fibonacci Heap Operations 506 11.4.4 Proof of the Time Bound 506 11.5 Splay Trees 509 Summary 513 Exercises 513 References 515 Chapter 12 Advanced Data Structures and Implementation 517 12.1 Top-Down Splay Trees 517 12.2 Red-Black Trees 525 12.2.1 Bottom-Up Insertion 526 12.2.2 Top-Down Red-Black Trees 527 12.2.3 Top-Down Deletion 531 12.3 Deterministic Skip Lists 535 12.4 AA-Trees 540 12.5 Treaps 547 12.6 k-d Trees 549 12.7 Pairing Heaps 553 Summary 558 Exercises 558 References 563 Appendix A Separate Compilation of Class Templates 567 A.1 Everything in the Header 568 A.2 Explicit Instantiation 568 A.3 The export Directive 570 Index 571

2017-09-11

人工智能及其应用 第4版(蔡自兴)

普通高等学校“十一五”国家级规划教材 国家级精品课程“人工智能”配套教材

2017-08-18

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除