ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Which of the following data structures is on average the 
fastest for retrieving data:


	

1) Binary Tree 	 


2) Hash Table 	 


3) Stack 	 

 Question Submitted By :: Viju
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack
Answer
# 1
3)stack
 
Is This Answer Correct ?    2 Yes 7 No
K.kavitha
 
  Re: Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack
Answer
# 2
hash table
 
Is This Answer Correct ?    7 Yes 0 No
Shruti
 
 
 
  Re: Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack
Answer
# 3
It depends on what you're looking for.  If you want to find
what you just inserted, then a stack would be best.  If you
have some sort of key that you're using to search through
the data, then it depends.

A hash table will generally be better, like Shruti said, but
if your container has few values and your key is large, then
doing a binary search might be faster than computing a hash
value for your key.  That, of course, requires your Binary
Tree to be sorted and at least somewhat optimized (not all
branching the same direction).  If your data is mostly
ordered, it's also possible to optimize your binary tree
search based on your previous search, but that will slow
down random data.  I personally use hash tables or...

A fourth option (if memory permits) is to convert your key
to an integer and use an array.  This one is quite easy to
implement (Boost even has one that is STL compliant, w/o
vector's overhead), and unless memory cache sizes come
heavily into play, this one is unbeatable.  An example would
be looking up a state's name by the two letter abbreviation.
 An array of 32768 char*'s isn't much, and on most computers
(including any x86/x86_64) you can simply look it up by
array[*(int*)"NY"].
 
Is This Answer Correct ?    8 Yes 0 No
Jbo5112
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO  5
What's a "sequence point"?  2
which of the function operator cannot be over loaded a) <= b)?: c)== d)* HCL7
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc  2
why we shiuld use main keyword in C  5
writw a program to insert an element in the begning of a doubly linked list  1
Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... } TCS4
struct ptr { int a; char b; int *p; }abc; what is d sizeof structure without using "sizeof" operator?? Verifone8
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access? Excel1
If "AaBbCc" is passed to the char char x(*a) { a[0]?x(a+1):1; printf("%c",a[0]); return 1; } what will be the output? Hughes5
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); } ME3
write a C code To reverse a linked list Motorola2
What will be the output of x++ + ++x? MBT13
What kind of sorting is this? SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort Accenture3
A function 'q' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as: A)int (*q(char*)) [] B)int *q(char*) [] C)int(*q)(char*) [] D)None of the Above Accenture2
write a program for size of a data type without using sizeof() operator?  7
How can I invoke another program from within a C program?  6
can we print any string in c language without using semicolon(;)(terminator) in whole program.  6
why the execution starts from main function  9
If we have an array of Interger values, find out a sub array which has a maximum value of the array and start and end positions of the array..The sub array must be contiguious. Take the start add to be 4000. For Ex if we have an array arr[] = {-1,-2,-5,9,4,3,-6,8,7,6,5,-3} here the sub array of max would be {8,7,6,5} coz the sum of max contiguous array is 8+7+6+5 = 26.The start and end position is 4014(8) and 4020(5). Microsoft4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com