CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS DATA STRUCTURE DETAILS
    Question :
    What is the heap?
    Category Data Structure Interview Questions
    Rating (0.9) By 225 users
    Added on 9/13/2009
    Views 1556
    Rate it!
    Answers:

    The heap is where malloc(), calloc(), and realloc() get memory.

    Getting memory from the heap is much slower than getting it from the stack. On the other hand, the heap is much more flexible than the stack. Memory can be allocated at any time and deallocated in any order. Such memory isn't deallocated automatically; you have to call free().
    Recursive data structures are almost always implemented with memory from the heap. Strings often come from there too, especially strings that could be very long at runtime. If you can keep data in a local variable (and allocate it from the stack), your code will run faster than if you put the data on the heap. Sometimes you can use a better algorithm if you use the heap faster, or more robust, or more flexible. Its a tradeoff.
    If memory is allocated from the heap, its available until the program ends. That's great if you remember to deallocate it when you're done. If you forget, it's a problem. A �memory leak is some allocated memory that's no longer needed but isn't deallocated. If you have a memory leak inside a loop, you can use up all the memory on the heap and not be able to get any more. (When that happens, the allocation functions return a null pointer.) In some environments, if a program doesn't deallocate everything it allocated, memory stays unavailable even after the program ends.



    in the heap sorting root node hold highest element after that lowest element to the root node is place at the left side and highest element placed at the right side and this process are continue until element become end.



    Posted by: delanpatel    

    Contact delanpatel Contact delanpatel

    heap means that the root element should be higher than the left node elements and lower than the right node elements!!!



    Posted by: viburani    

    Contact viburani Contact viburani

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    How can I search for data in a linked list?
    View Answer
    What is the quickest sorting method to use?
    View Answer
    Whether Linked List is linear or Non-linear data structure?
    View Answer
    Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes?
    View Answer
    What is a spanning Tree?
    View Answer
    In RDBMS, what is the efficient data structure used in the internal storage representation?
    View Answer
    List out few of the Application of tree data-structure?
    View Answer
    What are the methods available in storing sequential files ?
    View Answer
    What is the data structures used to perform recursion?
    View Answer
    If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
    View Answer
    List out the areas in which data structures are applied extensively?
    View Answer
    Name the data structure used to maintain file identification?
    View Answer
    Which one is faster? A binary search of an orderd set of elements in an array or a sequential search of the elements.
    View Answer
    What is binary tree?
    View Answer
    What are the various kinds of sorting techniques? Which is has best case?
    View Answer
    How can a node be inserted in the middle of a linked list?
    View Answer
    How many parts are there in a declaration statement?
    View Answer
    What is Linked List ?
    View Answer
    What method is used to place a value onto the top of a stack?
    View Answer
    Why is the isEmpty() member method called?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL Data Structure Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.046875 Seconds