Given a list of numbers ( fixed list) Now given any other
list, how can you efficiently find out if there is any
element in the second list that is an element of the
first list (fixed list)

Answer Posted / karan verma

Above method will be most efficient in terms of time
complexity that is O(n).
If we desire space complexity O(1)

--> sort the two lists O(nlogn)
--> find the missing no. O(n)

O(n+nlogn)=O(nlogn)
space complexity=O(1)

Is This Answer Correct ?    11 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2617


Sir... please give some important coding questions asked by product companies..

2067


How to palindrom string in c language?

10028


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2315


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3408


What is full form of PEPSI

2179


What is data _null_? ,Explain with code when u need to use it in data step programming ?

3082


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

2470


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

4437


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2571


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3310


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

771


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1359


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

4130


Cluster head selection in Wireless Sensor Network using C programming language.

3465