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
上传用户:糖儿水嘻嘻
TMS320F240DSP的汇编指令,用于了解该型号dsp的汇编指令的及具体含义,以便进行汇编指令的编写
标签: instruction 320F F240 TMS 320 240 set
上传时间: 2017-11-16
上传用户:yhj140260126
在学习得到的模型投放使用之前,通常需要对其进行性能 评估。为此, 需使用一个“测试集”(testing set)来测试 模型对新样本的泛化能力,然后以测试集上的“测试误差 ”(testing error)作为泛化误差的近似。
上传时间: 2020-04-22
上传用户:89feiyang
Homogeneous Partitioning of the Surveillance Volume discusses the implementation of the first of three sequentially complementary approaches for increasing the probability of target detection within at least some of the cells of the surveillance volume for a spatially nonGaussian or Gaussian “noise” environment that is temporally Gaussian. This approach, identified in the Preface as Approach A, partitions the surveillance volume into homogeneous contiguous subdivisions.
标签: Receivers Adaptive Antennas and
上传时间: 2020-05-26
上传用户:shancjb
Firstly, this book is set at a level suitable for senior undergraduate and postgraduate students who wish to understand the fundamentals and applications of adaptive array antenna systems. Array fundamentals are described in the text, and examples which demonstrate theoretical concepts are included throughout the book, as well as summaries and questions at the end of each chapter.
标签: Applications Fundamentals Adaptive Systems Array and
上传时间: 2020-05-26
上传用户:shancjb
The genesis for this book was my involvement with the development of the SystemView (now SystemVue) simulation program at Elanix, Inc. Over several years of development, technical support, and seminars, several issues kept recur- ring. One common question was, “How do you simulate (such and such)?” The sec- ond set of issues was based on modern communication systems, and why particular developers did what they did. This book is an attempt to gather these issues into a single comprehensive source.
标签: Communication Simulation Systems
上传时间: 2020-05-26
上传用户:shancjb
Complex networks are powerful allies of our quest to tackle complexity in all of science. Many lines can be written about the benefits of using networks to study complex systems. Nevertheless, if I had to name their single most appealing property,Iwouldsaysimplicity.Onecanmaptheinteractingelementsofanysystem to a set of nodes, and connect these nodes with a set of links according to their interactions.
上传时间: 2020-05-27
上传用户:shancjb
The genesis for this book was my involvement with the development of the SystemView (now SystemVue) simulation program at Elanix, Inc. Over several years of development, technical support, and seminars, several issues kept recur- ring. One common question was, “How do you simulate (such and such)?” The sec- ond set of issues was based on modern communication systems, and why particular developers did what they did. This book is an attempt to gather these issues into a single comprehensive source.
标签: Communication Introduction Systems to
上传时间: 2020-05-27
上传用户:shancjb
The outcome of the 3GPP SAE (system architecture evolution) technical study and specification work is a set of standards that specifies the evolution of the packet core network for GSM/GPRS and WCDMA/HSPA to an all-IP architec- ture and enables a feature-rich ‘common packet core’ for radio accesses devel- oped within 3GPP and also by other standardization fora.
标签: Evolved Packet Core SAE and the
上传时间: 2020-06-01
上传用户:shancjb
Reliable and accurate positioning and navigation is critical for a diverse set of emerging applications calling for advanced signal-processing techniques. This book provides an overview of some of the most recent research results in the field of signal processing for positioning and navigation, addressing many challenging open problems.
标签: Positioning Terrestrial Satellite Radio and
上传时间: 2020-06-01
上传用户:shancjb