题目链接:kth-largest-element-in-an-array 方法1: 使用快速排序。 1、对数组进行partition,从left到right随机选择一个主元pivot,将pivot与left的元素交换位置。 另索引 j 初始为left,扫描从left + 1到right的元素,若小于 ...
分类:
编程语言 时间:
2020-04-11 20:20:18
阅读次数:
73
理论(1)程序与进程程序:指令+参数通过逻辑控制运行起来,完成某项特定任务。 静态的,封闭的。进程:程序运行起来的结果。 操作系统运行的基本单位。 有生命周期(产生---->死亡) 进程有运行状态(running,sleepping,等待,僵死) 并发性,交互性(管道)----共享内存,队列(kaf... ...
分类:
系统相关 时间:
2020-04-11 13:13:37
阅读次数:
88
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu ...
分类:
其他好文 时间:
2020-04-06 11:37:02
阅读次数:
81
Problem : Given a list of non negative integers, arrange them such that they form the largest number. Example 1: Example 2: Note: The result may be ve ...
分类:
其他好文 时间:
2020-04-04 22:44:47
阅读次数:
75
Description今天小W用了1s不到的时候完成了这样一个题:在给定的N个整数 A_1,A_2,…,A_N中选出两个进行异或运算,得到的结果最大是多少?正当他志得意满时,L老师亮出了另一个题:给你1000个数字a1到a1000,从其中选出三个数字ai,aj,ak(1<=i,j,k<=1000,且 ...
分类:
其他好文 时间:
2020-04-03 18:05:23
阅读次数:
57
703. Kth Largest Element in a Stream & c++ priority_queue & minHeap/maxHeap 相关链接 "leetcode" "c++ priority_queue cplusplus" "c++ priority_queue cnblog" ...
分类:
编程语言 时间:
2020-04-01 10:54:46
阅读次数:
71
1. _KWAIT_BLOCK解析 struct _KWAIT_BLOCK { struct _LIST_ENTRY WaitListEntry; //0x0 同一可等待对象的下一个等待块 struct _KTHREAD* Thread; //0x8 等待线程 VOID* Object; //0xc ...
分类:
其他好文 时间:
2020-03-31 18:56:19
阅读次数:
85
SELECT CONCAT(table_schema, '.', table_name), CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), ...
分类:
数据库 时间:
2020-03-31 17:32:47
阅读次数:
74
Problem : Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element ...
分类:
其他好文 时间:
2020-03-30 16:41:09
阅读次数:
69
一、题目说明 题目215. Kth Largest Element in an Array,在一个无序数组中找第k大的元素。难度是Medium! 二、我的解答 这个题目最直观的解答是,先对数组排序,然后直接返回: 性能如下: 三、优化措施 用小根堆实现,无需多言: 上面2个方法都不是最好的办法:方法 ...
分类:
其他好文 时间:
2020-03-29 10:58:34
阅读次数:
60