2018年1月的全部文章
@kidultff

PAT-B 真题- 1075. 链表元素分类 / A 1133 Splitting A Linked List

原题干:给定一个单链表,请编写程序将链表元素进行分类排列,使得所有负值元素都排在非负值元素的前面,而[0, K]区间内的元素都排在大于K的元素前面。但每一类内部元素的顺序是不能改变的。例如:给定链表8→7→-4→0→5→-6→10→11→-2,K 为 10,则输 ...
  • 0
  • 0
@kidultff

PAT-A 真题- 1032. Sharing

题干:To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, "loading" and "being" ...
  • 0
  • 1
@kidultff

C语言-优先队列(priority queue)详解

0x00、优先队列(priority queue)priority queue是一个用"堆"实现的,类似set的容器,有着queue的基本功能。特征是"具有优先级,可以按照优先级出队"可能不是特别好理解,其实就是一个排序啦。。。举个栗子:3入队,4入队,1入队,如果是queue的容 ...
  • 3
  • 5
@kidultff

C语言-队列(queue)的应用

0x00、queue简介queue,即"队列",和我们平时的"排队"有所类似,是一个先进先出的容器。一张图更好理解:可以理解为,queue为一个容器,放入1,2,3,4四件物品,则出队顺序仍然是1,2,3,4C++STL中提供了queue的库函数,可以方便我们实现queue的数据结 ...
  • 0
  • 2
@kidultff

PAT-A 真题- 1051. Pop Sequence

题干:Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, ...
  • 0
  • 0