作业错题集锦(pta英文数据结构)
A graph with 30 vertices and 40 edges must have at most
twenty one connected component(s).
- 要计算最大连通分量,应该尽量先把边凑完,然后后面的每一个顶点分别是一个独立的连通分量
- 所以10 * 9 / 2 > 40 第一个连通分量用10个顶点,剩下20个顶点就是20个连通分量
- 最后加上第一个连通分量
Since the speed of a printer cannot match the speed of a computer, a buffer is designed to temperarily store the data from a computer so that later the printer can retrieve data in order. Then the proper structure of the buffer shall be a:
A.stack
B.queue
C.tree
D.graph
- 概念题
To build a heap from N records, the best time complexity is:
A.O(logN)
B.O(N)
C.O(NlogN)
D.O(N^2)
Heapify
从最后一个非叶子节点一直到根结点进行堆化的调整。如果当前节点小于某个自己的孩子节点(大根堆中),那么当前节点和这个孩子交换。Heapify是一种类似下沉的操作,HeapInsert是一种类似上浮的操作。
这种建堆的时间复杂度是O(N)
怎么找到第一个非叶子节点
根节点在数组中的索引为1,所以第一个非叶子节点的计算公式为: last_non_leaf = arr.length/2。
如果根节点在数组中的索引为0,那么第一个非叶子节点的计算公式为: last_non_leav = (arr.length - 2)/2
可以设最后一个非叶子节点位置为x,那么最后一个叶子节点一定是(2x+1) 或者(2x+2)中的一个,然后可以建立方程求解。
Which one of the following relations is correct about the extra space taken by heap sort, quick sort and merge sort?
A.heap sort < merge sort < quick sort
B.heap sort > merge sort > quick sor
C.heap sort < quick sort < merge sort
D.heap sort > quick sort > merge sort
空间复杂度堆排序O(1),快速排序O(logN),归并排序O(N);
The average search time of searching a hash table with N elements is:
A.O(1)
B.O(logN)
C.O(N)
D.cannot be determined
这个题有点争议,按照道理来讲平均查找时间复杂度是O(1),如果有冲突的话可能会退化到O(N)
目前只能先记一下答案。如果说的有不对的地方大家可以在评论区指出
If a binary search tree of N nodes is complete, which one of the following statements is FALSE?
A.the average search time for all nodes is O(logN)
B.the minimum key must be at a leaf node
C.the maximum key must be at a leaf node
D.the median node must either be the root or in the left subtree
可能会出现最后一个节点没有右子树的情况
To sort { 8, 3, 9, 11, 2, 1, 4, 7, 5, 10, 6 } by Shell Sort, if we obtain ( 4, 2, 1, 8, 3, 5, 10, 6, 9, 11, 7 ) after the first run, and ( 1, 2, 3, 5, 4, 6, 7, 8, 9, 11, 10 ) after the second run, then the increments of these two runs must be __ , respectively.
A.3 and 1
B.3 and 2
C.5 and 2
D.5 and 3
哈希排序可以看上一篇博客
To delete X from a splay tree, the operations are: (1) Find X; (2)Remove X; (3) FindMin(T
R); and the last operation is:
A.Make T L the right child of the root of T R
B.Make T L the left child of the root of T R
C.Make T R the right child of the root of T L
D.Make T R the left child of the root of T L
Let T be a tree of N nodes created by union-by-size without path compression, then the minimum depth of T may be
A.1
B.logN
C.N−1
D.N/2
Given an integer sequence 25、84、21、47、15、27、68、35、20, after the Heapsort's initial heap building, this interger sequence is __.
A.47 20 21 25 84 27 68 35 15
B.15 21 20 25 84 27 68 35 47
C.15 20 21 25 84 27 68 35 47
D.25 15 20 47 35 21 68 84 27
Given an integer sequence 25、84、21、47、15、27、68、35、20, after the first run of the shell sorting by an increment 3, the integer sequence is __.
A.25 15 20 27 35 21 68 84 47
B.15 21 20 25 84 27 68 35 47
C.25 15 20 47 21 35 68 84 27
D.25 15 20 47 35 21 68 84 27
希尔排序可以看上一篇博客
One of the following algorithms: Selection sort, Shell sort, Insertion sort, is applied to sort the sequence (2, 12, 16, 88, 1, 5, 10)in ascending order. If the resulting sequences of the first two runs are (2, 12 , 16, 10, 1, 5, 88) and (2, 12, 5, 10, 1, 16, 88), then the algorithm must be ____.
A.Selection sort
B.Shell sort
C.Insertion sort
D.uncertain
For a graph, if each vertex has an even degree, we can find an Euler circuit that visits every vertex exactly once.
T F
Linear probing is equivalent to double hashing with a secondary hash function of Hash 2(k)=1 .
T F
Quadratic probing is equivalent to double hashing with a secondary hash function of Hash (k)=k.
T F
In a binary tree, if node A is a descendant of node B, A may precede B in the inorder traversal sequence.
T F
To prove the correctness of a greedy algorithm, we must prove that an optimal solution to the original problem always makes the greedy choice, so that the greedy choice is always safe.
T F
To sort N records by quick sort, the worst-case time complexity is Ω(NlogN).
T F
作业错题集锦(pta英文数据结构)的更多相关文章
- 错题集锦(二) -- Java专项
错题集锦(二) -- Java专项 标签(空格分隔): 找工作 JVM的内存模型 线程共享: 堆(Heap):主要存放一些对象实例 方法区(Method Area / Non-Heap):用于存储已被 ...
- Web前端错题模糊题记录
title: Web前端错题模糊题记录 toc: true date: 2018-09-20 10:04:36 categories: Web tags: HTML CSS JavaScript HT ...
- 计算机二级C语言选择题错题知识点记录。
计算机二级C语言选择题错题知识点记录. 1,在数据流图中,用标有名字的箭头表示数据流.在程序流程图中,用标有名字的箭头表示控制流. 2,结构化程序设计的基本原则:自顶向下,逐步求精,模块化,限制使用g ...
- Ajax与JqueryUI和EasyUI错题总结
Ajax与JqueryUI和EasyUI错题总结 正确答案A,解析:此题考察的是JQuery UI下的menu插件的使用,menu提供ui-state-disabled class 方法禁用任何菜单项 ...
- objective-c 错题
//1, NSString *name = [[NSString alloc]initWithString:@"张三"]; NSLog(@"%d",[name ...
- hibernate错题解析
01 Hibernate错题分析 解析: 此题目考查的是对Hibernate中交叉连接的理解.HQL支持SQL风格的交叉连接查询,交叉连接适用于两个类之间没有定义任何关联时.在where字句中,通 ...
- 20175316盛茂淞 《java程序设计》第三周课堂测试错题总结
20175316盛茂淞 <java程序设计>第三周课堂测试错题总结 出现问题 错题总结 题目1 在Ubuntu中用自己的有位学号建一个文件,教材p87 Example4_15 1. 修改代 ...
- NOIp2014提高组初赛错题简析
总体分析 \(89pts\),粗略来看选择题错的比较多,\(-6pts\).同时又是尿性的填空杀扣了\(5pts\). 不过后面的两大题全对了还是可喜可贺 错题精析 单项选择T8 编译器的主要功能是( ...
- Java 整体测试重点题 错题积累
重点题 错题积累 1: 解析: %d:用来设置输出日志的日期和时间 %m:用来输出代码中指定的消息 %n:用来输出一个回车换行符 %l:用来输出日志事件的发生位置 %p:用来输出优先级 %f:用 ...
- Java多线程习题 ===重点 ,错题积累
多线程重点,错题分析 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: . 12: 13: 14: 15:
随机推荐
- 美团一面问我i++跟++i的区别是什么
美团一面问我i++跟++i的区别是什么 面试官:"i++跟++i的区别是什么?" 我:"i++是先使用然后再执行+1的操作,++i是先执行+1的操作然后再去使用i&quo ...
- C# winform GDI+ 五子棋 (一):基本界面和胜负判断
棋盘和棋子采用GDI+画上去的.棋盘18*18.棋子是用DrawElipse画的,白棋和黑棋分两个List集合存储,方便判断五子连线的情况. 主要说一下,五子连线的思路,把集合按行和按列以及按正斜和反 ...
- Sqlserver存储过程中使用try-catch和事务
BEGIN TRY BEGIN TRANSACTION --逻辑代码 COMMIT TRANSACTION --提交事务 END TRY BEGIN CATCH SELECT @Msg = ERROR ...
- Nginx的正向代理和反向代理
1.Nginx代理 (1)Nginx出现的早期就是作为一个高性能的http.反向代理的web服务器. (2)同时它也提供了IMAP/POP3/SMTP服务,也就是电子邮件代理服务器. (3)它的特点就 ...
- Angular等了三年,那个她已经来了
Angular生态丰富,功能强大,支撑了许多大型项目的开发.而且一直在前方等待着其他框架跟上.但是不得不直面的一个问题就是:"在等待其他框架跟上的这三年",Angular在陆陆续续 ...
- 挨个配置资源组太麻烦?ROS伪参数一步搞定!
介绍 伪参数 伪参数是资源编排服务ROS的编排引擎提供的固定参数,即在编写模板时可以使用的一系列预定义的参数,它们为模板提供了资源部署过程中的环境和执行上下文信息. 更多伪参数介绍请查看:ROS伪参数 ...
- 给师妹写的《Java并发编程之线程池十八问》被表扬啦!
写在开头 之前给一个大四正在找工作的学妹发了自己总结的关于Java并发中线程池的面试题集,总共18题,将之取名为<Java并发编程之线程池十八问>,今天聊天时受了学妹的夸赞,心里很 ...
- ReplayKit2 采集音视频回调格式
一.音频 ReplayKit2 RPSampleBufferTypeAudioApp sampleBuffer = CMSampleBuffer 0x100500c50 retainCount: 1 ...
- 将手机声音通过蓝牙输入到WIN10电脑-安卓手机投屏直播无声音
安卓手机投屏无声音,斗鱼,虎牙,直播无声音.可以用本方案,前提是电脑要有蓝牙功能,没有蓝牙,可以购买一个USB蓝牙适配器(不建义买CSR芯片的,CSR驱动会导致office 和远程桌面有问题). 操作 ...
- Vue学习:18.Vue插槽
Vue 中的插槽(slot)是一种灵活的机制,用于在父组件中将内容传递到子组件的特定位置.它允许我们在子组件中定义可以在父组件中传递任意内容的"插槽",从而实现更灵活的组件化. 在 ...