Question

How can we measure space/memory efficiency in Java Programming? Is it possible to do so with...

How can we measure space/memory efficiency in Java Programming? Is it possible to do so with Big O Notation to an extent? I was told that while the element of speed is important, in some systems you need to be concerned about being lightweight as well (even at the cost of speed). In some embedded systems you might need to severely limit the amount of memory available to a device. How would you approach a solution to that sort of problem?

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

Firstly it is important to note that there is no such thing as space/memory efficiency in Java Programming or in fact, any programming language. Whenever we talk about space/memory efficiency we talk about the efficiency of algorithms without concern to any specific programming language. Whenever we talk about measuring the efficiency of an algorithm, we talk about its efficiency in two spheres, one: time of execution & second: memory required in execution, we call those 'measures' as time complexity and space complexity respectively. Since, we can have different times of execution & different memory requirements on machines/systems with different hardware and architecture, hence, we measure these complexities using the asymptotic notations. The asymptotic analysis enables us to define an asymptotic complexity class for the given algorithm which again might vary with different inputs for a given algorithm. For example: Quicksort algorithm for sorting a list performs worst for already sorted data with complexity of the order of n2 for the input size of n and performs much better for randomly sorted data with complexity of the order of nlogn. This variation causes great variation in the performance of algorithm for inputs of larger sizes. Hence, we measure the worst case time complexity for an algorithm and using that we compare the algorithm with each other. Another important point to be noted is that Big-Oh notation is often mistaken for the worst case time complexity which is NOT the case. Big-Oh defines the upper bound to an algorithm which might be used to define the worst case time but it is an entirely different concept in the sense that it applies to functions for determining their upper bound and not the worst case or best case.

Another important concept is that of the time-space trade off in which decreasing the time complexity leads to increase in the space complexity of an algorithm and vice versa. For systems with severe restrictions on memory to be used, space complexity may be given preference and for the ones with more memory available for execution, time complexity should be given preference. It has been rightly pointed out that memory restrictions may be severe in some programming environments but we can't define any standard for preferring one complexity over another as scenarios tend to be too diverse in nature and real time decisions on the basis of given scenario have to be made. Finally, it all boils down to prioritizing the importance of one over another and thereby deciding which one to minimize at the cost of the other.

Add a comment
Know the answer?
Add Answer to:
How can we measure space/memory efficiency in Java Programming? Is it possible to do so with...
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
  • 3. DRAM: How Big Can We Make Them? Nearly all devices that include some form of...

    3. DRAM: How Big Can We Make Them? Nearly all devices that include some form of computational capability (phones, tablets, gaming consoles, laptops,.. use a type of memory known as Dynamic Random Access Memory (DRAM). DRAM is where the "working set" of instructions and data for a processor is typically stored, and the ability to pack an ever increasing number of bits on to a DRAM chip at low cost has been critical to the continued growth in computational capability...

  • C programming is the main one and pick another code of choice!!! Background This assignment is...

    C programming is the main one and pick another code of choice!!! Background This assignment is based on one of the Big Ideas in this course, namely that reading C source code is a real aid in learning how to write C code. To that end, in this project, you write a program that scans C source from the 'Net and calculates some simple statistics. We're learning lots of concepts, and by running the program you write here on several...

  • JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The...

    JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The best-case performance for a shell sort is: --- O(1) O(n2)   O(n) O(n log n)   Signaler cette question Question 22 points The best-case performance for an array of n items using insertion sort is: --- O(n2)   O(n) O(1) there is no best-case Signaler cette question Question 3 2 points A recursive method that processes a chain of linked nodes --- uses the first node in...

  • Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as...

    Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as a Constraint Satisfaction Problem, with the following guidelines: 1. Since 3 x 3 puzzles are too trivial for a computer, your program should use 4 x 4 puzzles (also known as Super Sudoku puzzles; see Figure 2 for an example). 2. The program should read a Sudoku puzzle from a text file. The user should be able to browse the file system to select...

  • Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your...

    Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...

  • Need this in C The starter code is long, if you know how to do it...

    Need this in C The starter code is long, if you know how to do it in other way please do. Do the best you can please. Here's the starter code: // ----------------------------------------------------------------------- // monsterdb.c // ----------------------------------------------------------------------- #include #include #include // ----------------------------------------------------------------------- // Some defines #define NAME_MAX 64 #define BUFFER_MAX 256 // ----------------------------------------------------------------------- // Structs typedef struct { char name[NAME_MAX]; int hp; int attackPower; int armor; } Character; typedef struct { int size; Character *list; } CharacterContainer; // ----------------------------------------------------------------------- //...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

  • Amazon to Competition: We Will Crush You! Amazon to Employees: We Will Churn You! Globally, Amazon...

    Amazon to Competition: We Will Crush You! Amazon to Employees: We Will Churn You! Globally, Amazon is one of the largest and most successful companies in any industry. Technological innovation has contributed to its success, as has its employee acquisition practices, which are exceptionally high. The question is what has allowed this company to thrive and maintain its success? This activity is important because it shows how companies like Amazon hire based on personality and individual differences. Such companies place...

  • Please, i need Unique answer, Use your own words (don't copy and paste). Please, don't use...

    Please, i need Unique answer, Use your own words (don't copy and paste). Please, don't use handwriting, Use your keyboard. I need you to  redrafting my answer, please.. Q1. How does UPS's approach toward sustainability impact the triple bottom line? Be specific. As a founding member of UPS’s sustainability steering committee have wrestled with the challenge and developed a point of view, one that emphasizes the power of organizational momentum and embraces “enlightened self-interested the companies have a responsibility to contribute...

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