1.Describe a Θ(n lg n)-time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x. (Implement exercise 2.3-7.) #include<stdio.h> #include<stdlib.h> void merge(int arr[],int low,int mid,int high){ int i,k; int *tmp=(int*)malloc((high-low+1)*sizeof(int)); int left_low=low; int left_high=mid; int right_low=mid+1; int right_high=high; for(k=0;left_low<=left_high&&right_low<=right_high;k++) { if(arr[left_low]<=arr[right_low]){ tmp[k]=arr[left_low++]; } else{ tmp[k]=arr[right_low++]; } } if(left_low<=left_high){ for(i=left_low;i<=left_high;i++){ tmp[k++]=arr[i]; } } if(right_low<=right_high){ for(i=right_low;i<=right_high;i++) tmp[k++]=arr[i]; } for(i=0;i<high-low+1;i++) arr[low+i]=tmp[i]; } void merge_sort(int a[],int p,int r){ int q; if(p<r){ q=(p+r)/2; merge_sort(a,p,q); merge_sort(a,q+1,r); merge(a,p,q,r); } } int main(){ int a[8]={3,5,8,6,4,1,1}; int i,j; int x=10; merge_sort(a,0,6); printf("after Merging-Sort:\n"); for(i=0;i<7;i++){ printf("%d",a[i]); } printf("\n"); i=0;j=6; do{ if(a[i]+a[j]==x){ printf("exist"); break; } if(a[i]+a[j]>x) j--; if(a[i]+a[j]<x) i++; }while(i<=j); if(i>j) printf("not exist"); system("pause"); return 0; }
上传时间: 2017-04-01
上传用户:糖儿水嘻嘻
The CommScope InstaPATCH® 360 and ReadyPATCH® solutions utilize a standards-compliant multi-fiber connector to provide high density termination capability. The connector is called an MPO (Multi-fiber Push On) connector by the standards. In many cases, multi-fiber connector products are referred to as MTP connectors. This document is intended to clarify the difference between the two terms – MPO and MTP.
上传时间: 2017-04-12
上传用户:asdfghjkl1234567890
virtex ultra scale plus 16nm vcu 188 board user guide. For high speed and ultra scale design prototype.
上传时间: 2017-05-16
上传用户:hewangfeng
Improved guaranteed cost control and quantum adaptive control are developed in this study for a quadrotor helicopter with state delay and actuator faults. Improved guaranteed cost control is designed to eliminate disturbance effects and guarantee the robust stability of a quadrotor helicopter with state delay. The inapplicability of guaranteed cost control to the quadrotor linear model is addressed by combining guaranteed cost control with a model reference linear quadratic regulator. In the event of actuator faults, quadrotor tracking performance is maintained through quantum adaptive control. Finally, the availability of the proposed scheme is verified through numerical simulation
标签: Control Helicopter Guaranteed Quadrotor Adaptive Strategy Improved Quantum Delay State
上传时间: 2017-07-15
上传用户:bingzi_ml
Lithium–sulfur batteries are a promising energy-storage technology due to their relatively low cost and high theoretical energy density. However, one of their major technical problems is the shuttling of soluble polysulfides between electrodes, resulting in rapid capacity fading. Here, we present a metal–organic framework (MOF)-based battery separator to mitigate the shuttling problem. We show that the MOF-based separator acts as an ionic sieve in lithium–sulfur batteries, which selectively sieves Li+ ions while e ciently suppressing undesired polysulfides migrating to the anode side. When a sulfur-containing mesoporous carbon material (approximately 70 wt% sulfur content) is used as a cathode composite without elaborate synthesis or surface modification, a lithium–sulfur battery with a MOF-based separator exhibits a low capacity decay rate (0.019% per cycle over 1,500 cycles). Moreover, there is almost no capacity fading after the initial 100 cycles. Our approach demonstrates the potential for MOF-based materials as separators for energy-storage applications.
上传时间: 2017-11-23
上传用户:653357637
Lithium–sulfur (Li–S) batteries with high energy density and long cycle life are considered to be one of the most promising next-generation energy-storage systems beyond routine lithium-ion batteries. Various approaches have been proposed to break down technical barriers in Li–S battery systems. The use of nanostructured metal oxides and sulfides for high sulfur utilization and long life span of Li–S batteries is reviewed here. The relationships between the intrinsic properties of metal oxide/sulfide hosts and electrochemical performances of Li–S batteries are discussed. Nanostructured metal oxides/ sulfides hosts used in solid sulfur cathodes, separators/interlayers, lithium- metal-anode protection, and lithium polysulfides batteries are discussed respectively. Prospects for the future developments of Li–S batteries with nanostructured metal oxides/sulfides are also discussed.
上传时间: 2017-11-23
上传用户:653357637
en.CD00004003_Designing with L4973, 3.5 A high efficiency DC-DC converter,en.CD00004003_Designing with L4973, 3.5 A high efficiency DC-DC converter
上传时间: 2017-12-24
上传用户:jatcreo@qq.com
DESIGNING WITH L4978, 2A HIGH EFFICIENCY DC-DC CONVERTERY
上传时间: 2017-12-24
上传用户:jatcreo@qq.com
void IIC_Init(void) { //由于STM8单片机,可以在输入和输出条件下读取IO口状态,故直接设置为输出。 GPIO_Init(IIC_SCL_PORT, IIC_SCL_PIN, GPIO_MODE_OUT_OD_HIZ_SLOW ); GPIO_Init(IIC_SDA_PORT, IIC_SDA_PIN, GPIO_MODE_OUT_OD_HIZ_SLOW ); IIC_SCL_H; IIC_SDA_H; } //产生IIC起始信号 void IIC_Start(void) { IIC_SDA_H; IIC_SCL_H; Delay_us(); IIC_SDA_L; //START:when CLK is high,DATA change form high to low Delay_us(); IIC_SCL_L; //钳住I2C总线,准备发送或接收数据 }
上传时间: 2018-01-10
上传用户:m009988
The 4.0 kbit/s speech codec described in this paper is based on a Frequency Domain Interpolative (FDI) coding technique, which belongs to the class of prototype waveform Interpolation (PWI) coding techniques. The codec also has an integrated voice activity detector (VAD) and a noise reduction capability. The input signal is subjected to LPC analysis and the prediction residual is separated into a slowly evolving waveform (SEW) and a rapidly evolving waveform (REW) components. The SEW magnitude component is quantized using a hierarchical predictive vector quantization approach. The REW magnitude is quantized using a gain and a sub-band based shape. SEW and REW phases are derived at the decoder using a phase model, based on a transmitted measure of voice periodicity. The spectral (LSP) parameters are quantized using a combination of scalar and vector quantizers. The 4.0 kbits/s coder has an algorithmic delay of 60 ms and an estimated floating point complexity of 21.5 MIPS. The performance of this coder has been evaluated using in-house MOS tests under various conditions such as background noise. channel errors, self-tandem. and DTX mode of operation, and has been shown to be statistically equivalent to ITU-T (3.729 8 kbps codec across all conditions tested.
标签: frequency-domain interpolation performance Design kbit_s speech coder based and of
上传时间: 2018-04-08
上传用户:kilohorse