PAT Class A compilation of questions classified - Introduction

Today, open pit, sort PAT Class title ( https://pintia.cn/problem-sets/994805342720868352/problems/type/7 ) in 1051 to 1100 section. Language is a modern C ++.

Why do you want to organize it, because I'm in September 2019 to test PAT grade, although the first test, although only learned data structure ( https://mooc.study.163.com/course/1000033001?tid=2402970002 # / info ), but I want to go directed at the high score.

 

The following table outlines the effect of these 50 questions, and classified.

Question number title fraction main idea Types of
1051 Pop Sequence 25 Determining whether a sequence is a sequence of pop theory
1052 Linked List Sorting 25 Sort the list theory
1053 Path of Equal Weight 30 Looking for a certain weight of the tree path tree
1054 The Dominant Color 20 Looking up to the emergence of a number Linear
1055 The World's Richest 25 Define the scope sort results Sequence
1056 Mice and Rice 25 Packet sequencing Sequence
1057 Stack 30 A stack median function theory
1058 A+B in Hogwarts 20 Special binary adder Compute
1059 Prime Factors 25 Decomposition prime factors Compute
1060 Are They Equal 25 Under certain accuracy of two numbers are equal Compute
1061 Dating 20 Looking for the same character string Linear
1062 Talent and Virtue 25 Sort certain rules Sequence
1063 Set Similarity 25 Set of similarity set
1064 Complete Binary Search Tree 30 Complete binary search tree tree
1065 A+B and C (64bit) 20 Compare with the addition of large numbers Compute
1066 Root of AVL Tree 25 AVL tree root tree
1067 Sort with Swap(0, i) 25 By exchanging element numbers 0 to sort mathematics
1068 Find More Coins 30 Subset sum problem algorithm
1069 The Black Hole of Numbers 20 Number of black hole Compute
1070 Mooncake 25 Knapsack problem algorithm
1071 Speech Patterns 25 Looking up to the emergence of the word Linear
1072 Gas Station 30 The maximum shortest distance, distance is not overrun Map
1073 Scientific Notation 20 Scientific notation reduction Compute
1074 Reversing Linked List 25 Reversal list segmentation theory
1075 PAT Judge 25 Sorting complex Sequence
1076 Forwards on Weibo 30 A certain number of layers forwarding count Map
1077 Kuchiguse 20 Common suffix string Linear
1078 Hashing 25 Hash Hash
1079 Total Sales of Supply Chain 25 Calculating the supply chain total sales Map
1080 Graduate Admission 30 Volunteer and admission Sequence
1081 Rational Sum 20 Rational addition Compute
1082 Read Number in Chinese 25 Chinese reading Linear
1083 List Grades 25 Define the scope sort results Sequence
1084 Broken Keyboard 20 Comparison between two sequences Linear
1085 Perfect Sequence 25 Subject to the constraints of the maximum number of column length set
1086 Tree Traversals Again 25 Preorder backstepping tree
1087 All Roads Lead to Rome 30 Heavy weights complex shortest path problem Map
1088 Rational Arithmetic 20 RATIONAL Compute
1089 Insert or Merge 25 Analyzing insertion sort or merge sort theory
1090 Highest Price in Supply Chain 25 Supply Chain highest price Map
1091 Acute Stroke 30 Exceeds the threshold value and the volume of the space Map
1092 To Buy or Not to Buy 20 Analyzing subset set
1093 Count PAT's 25 Number of substring mathematics
1094 The Largest Generation 25 Most elements in the tree layer tree
1095 Cars on Campus 30 Analog vehicle access Linear
1096 Consecutive Factors 20 The longest continuous factor Compute
1097 Deduplication on a Linked List 25 To re-list theory
1098 Insertion or Heap Sort 25 判断插入排序或堆排序 理论
1099 Build A Binary Search Tree 30 建立二叉搜索树
1100 Mars Numbers 20 进制转换 计算

一共分了10类:

计算,一些纯数学计算的题,如进制转换;

线性,算法时间复杂度为常数或线性的题,如字符串类;

理论,以理论为背景的题,如链表操作、判断何种排序算法;

集合,以集合为主要工具的题;

树,以树为背景或主要工具的题;

图,需要建立图的题;

排序,纯排序题;

散列,涉及到散列的题;

数学,需要组合数学知识的题;

算法,用到算法设计课程中强调的算法的题,如贪心算法。

一些题目比较少的类别可能会并在一起讲。此外,我发现有些知识点在这50道题里面没有出现过(目前发现,我只粗略地看过一遍),可能会有一篇文章来补充。

每种类型的题目我会总结共性,简述可能的变形,最后挑一两道较难的放上代码。

 

最后说一下笔者的编码习惯。

喜欢C++11,几乎没有一道题我的代码是可以在C++98/03的标准下通过的。有时候我会忘记一个特性是不是来自C++14/17,但是我保证此系列中所有代码都可以在PAT OJ的g++编译器中通过编译并AC。

喜欢换行。左右大括号都独占一行,没有大括号的if、while、for等block会换行并缩进。

喜欢用 std::vector ,几乎不会根据输入上限建立数组。这是因为我是玩单片机的,没那么多内存可以浪费。 std::vector 在初始化时确定好大小或用 reserve(...) 分配好空间后效率还是可以的。

喜欢用 std::cin 和 std::cout 做输入输出,因为我没参加过计算机竞赛,没遇到过严格的时间限制。既然C++提供了类型安全的输入输出方式,那就用。

喜欢用C++中各种“++”的部分。按使用率从高到低排序应该是类、运算符重载、模板、继承。关于继承我以后会单独开一个专题系列。

我自认为我的代码是现代的、优雅的。如果你有办法让我的代码更优雅,欢迎评论。这种优雅确实会带来一定的代码膨胀与性能损失,如果你受不了,可以去参考别人的代码。

 

文章链接(持续更新中):

还没开始写呢

Guess you like

Origin www.cnblogs.com/jerry-fuyi/p/11241915.html