Design a time algorithm, Data Structure & Algorithms

Q. An, array, A comprises of n unique integers from the range x to y(x and y inclusive where n=y-x). Which means, there is only one member that is not in A. Design an O(n) time algorithm to find that number.       



The algorithm to find the number that is not array A where n contains n

unique (n = x - y):

find(int A[],n,x,y)


int i,missing_num,S[n]; for(i=0, i

{if(S[i] == -999)


missing_num = i + x;





Posted Date: 7/10/2012 3:39:56 AM | Location : United States

Related Discussions:- Design a time algorithm, Assignment Help, Ask Question on Design a time algorithm, Get Answer, Expert's Help, Design a time algorithm Discussions

Write discussion on Design a time algorithm
Your posts are moderated
Related Questions
Define about the class invariant A class invariant may not be true during execution of a public operation though it should be true between executions of public operations. For


This section prescribes additional exercise with the recursive and iterative handling of a binary search tree. Adding to the Binary Search Tree Recursively Add implementation

The above 3 cases are also considered conversely while the parent of Z is to the right of its own parent. All the different kind of cases can be illustrated through an instance. Le

Each data record contains a fixed place in a relative file. Each record ought to have associated with it in integer key value which will help identify this slot. Therefore, this ke

Define Spanning Tree A Spanning Tree of a connected graph is its linked acyclic sub graph (i.e., a tree) that having all the vertices of the graph.

#question. merging 4 sorted files containing 50,10,25,15 records will take time?

write pseudocode to implement a queue with two stacks

Illustrate the Visual realism applications a)   Robot Simulations : Visualization of movement of their links and joints  and end effector movement etc. b)  CNC programs ver

Which are the two standard ways of traversing a graph? i. The depth-first traversal   ii. The breadth-first traversal