Question

Please help! Thank You... 1. If we have to use a global variable, what technique can...

Please help! Thank You...

1. If we have to use a global variable, what technique can we use to easily identify it as such?

2. What is required to maintain a partially-filled array?

3. At what array size does it become beneficial to use a binary search instead of a linear search?

4. Describe what a min heap data structure can be used for. Include a picture of one.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) One of the technique to identify whether we should go for a global variable is that if there is some state which is used across the files in the code then that must be maintained as a global variable If that state is read or modified across the files,basically it is the usage of each variable which determines where it should be declared.

2)To maintain a partially filled array we have to maintain the current size of the array,so that in the event of relocation or copying we can use the current size to copy the current contents of the array.

3)If the array size is too large and if the array is sorted then using binary search becomes beneficial to search for an element in log(N) time.

4).Minimum Heap data structure can be used in priority queue,or to find the 1st minimum 2nd minimum elements in the array.

It is structured as the minimum element will be at the root location.

Add a comment
Know the answer?
Add Answer to:
Please help! Thank You... 1. If we have to use a global variable, what technique can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please be as descriptive as you can In Chapter 3, we have studied techniques for solving...

    Please be as descriptive as you can In Chapter 3, we have studied techniques for solving linear systems. Given the coeffi- cient matrix for the system, we can use these techniques to classify the system, describe the qualitative behavior of solutions, and give a formula for the general solution. In this lab we consider a two-parameter family of linear systems. The goal is to better under- stand how different linear systems are related to each other, or in other words,...

  • Interfaces 1. What is inside an interface definition? What does a class do to an interface...

    Interfaces 1. What is inside an interface definition? What does a class do to an interface and what keyword is involved? How does a class do this to an interface (what should we find in the class)? Can an interface have a generic parameter? How do you instantiate an interface as an object? What methods can’t you use on an interface type? Abstract Data Types 2. What does an ADT define? Does an ADT specify programming language and/or data structures...

  • SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...

    SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what choices does one make when creating a class that is an example of Abstraction? Encapsulation: What is encapsulation? What is information hiding? What does a public interface to a class consist of (not in the sense of actual java interfaces but what the client uses to manipulate objects of the class) What is an object of a class? What is the constructor? How do...

  • PLEASE HURRY! I only have 30 minutes for these questions. thank you! Following is an incorrect...

    PLEASE HURRY! I only have 30 minutes for these questions. thank you! Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced: declare a character stack while ( more input is available) read a character if ( the character is a) push it on the stack pop a character off the stack print "unbalanced" and exit else if ( the character is a ')' and the stack is not empty)...

  • Assignment 5 will be way different. It will be more like what you will receive in...

    Assignment 5 will be way different. It will be more like what you will receive in a programming shop. By that I mean that some things are built for you and others you will need to create or finish. P.S. part of your grade will include: Did you add in the required files? Did you rename your project? does your linear searches work? Did you put your code in the correct modules? did you change modules that you weren't supposed...

  • Hello I have an automata question could you help me? [1Points] Give a formal description of a Tu...

    Hello I have an automata question could you help me? [1Points] Give a formal description of a Turing Machine M  that takes two parameters: an integer and an array of integers and decides whether the given integer is an element of the array or not. You can assume that all the integers are between 0 and 9. The input string will be written on the tape of the Turing machine. The first square of the tape contains the integer, the...

  • C++ please read all the question Create 3 large arrays to search, where the size will be variable up until it reaches your machines limit. They should contain the same information since we are going t...

    C++ please read all the question Create 3 large arrays to search, where the size will be variable up until it reaches your machines limit. They should contain the same information since we are going to compare 3 different algorithms.You are going to do operational studies on them to determine their order. O(N), O(log(N)), and O(1)? Search algorithms.Linear, Binary, Hash You should know which algorithms are what order,now you are going to prove it. Fill the 3 arrays with the...

  • Can someone please help me with this code? I'm writing in C++. Thank you in advance....

    Can someone please help me with this code? I'm writing in C++. Thank you in advance. Complete a program that represents a Magic Eight Ball (a Magic Eight Ball allows you to ask questions and receive one of several random answers). In order to complete this, you will need a couple of new functions. First, in order to get a line of input that can contain spaces, you cannot use cin, but instead will use getline: string question; cout <<...

  • c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please...

    c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please do all parts. previously I post 3 time for part1 ,2 and 3 but I can't make it into one complete program code. I even try to post a questions ask and post the 3 parts of code for experts to put it together. But experts said it's not enough information. please help... Thank you ! Program Objectives: Allow students to create arrays Allow...

  • please be thorough with explanations. thank you Question 2 Consider the implementation we made in class...

    please be thorough with explanations. thank you Question 2 Consider the implementation we made in class for ArrayList, and its extensions you did in the lab. In this question, we will add two more methods to this class: the insert method and the pop method. For this question, please submit the modified ArrayList class. a) Implement the method insert (self, index, val) that inserts val before index (shifting the elements to make room for val). For example, your implementation should...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT